题目:输入第一行为一个正整数n(1≤n≤1000),下面n行为n个字符串(字符串长度≤100),字符串中只含有大小写字母。
数据输出n行,输出结果为按照字典序排列的字符串。
编程语言:C++;难度:中等
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string str;
while(cin >> str)
{
sort(str.begin(), str.end());
cout << str <<endl;
}
return 0;
}
参考:https://www.nowcoder.com/ta/huawei
https://www.nowcoder.com/profile/136407689/codeBookDetail?submissionId=92224770