#include<bits/stdc++.h> using namespace std; int main() { string str; while (cin >> str) {//输入字符串 if (str.length() == 0) { break; } sort(str.begin(), str.end());//对字符串中的字符进行排序 cout << str << endl;//输出排好序的字符串 } }
string的排序:sort(s.begin(),s.end())
#include<bits/stdc++.h> using namespace std; int main() { string str; while (cin >> str) {//输入字符串 if (str.length() == 0) { break; } sort(str.begin(), str.end());//对字符串中的字符进行排序 cout << str << endl;//输出排好序的字符串 } }
string的排序:sort(s.begin(),s.end())