3 条题解

  • 0
    @ 2025-1-8 11:32:23
    #include <iostream>
    #include <algorithm>
    #include <string>
    using namespace std;
    
    int main()
    {
        int n;
        cin >> n;
        string a;
        while (n--)
        {
            cin >> a;
            sort(a.begin(), a.end());
            for (int i = 0; i < a.size(); i++)
            {
                cout << a[i]<<" ";
            }
            cout << endl;
        }
        return 0;
    }
    }strlen测量的是字符串常量,而cin就表明这个字符串不是常量是变量,所以我们用size()去测量长度,用的是c++里面的string类型定义字符串
    

    信息

    ID
    120
    时间
    3000ms
    内存
    128MiB
    难度
    7
    标签
    递交数
    2313
    已通过
    528
    上传者