题解 | #图片整理#__huawei_no.34-2
图片整理
https://www.nowcoder.com/practice/2de4127fda5e46858aa85d254af43941
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
string str;
getline(cin, str);
for (int i = 0; i < str.size(); i++) {
for (int j = 0; j < str.size() - 1; j++) {
if ( (str[j] ) > (str[j + 1])) {
swap(str[j], str[j + 1]);
}
}
}
cout << str << endl;
return 0;
}
// 64 位输出请用 printf("%lld")
直接冒泡排序来一波

阿里云工作强度 731人发布