#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { string s; getline(cin, s); // 读取整行字符串 // 提取所有字母 vector<char> letters; for (char c : s) { if (isalpha(c)) { letters.push_back(c); } } // 排序,不区分大小写,稳定排序保持同字母大小写输入顺序 stable_sort(letters.begin(), letters.end(), [](char a, char b) { return tolower(a) < tolower(b); }); // 用排序好的字母替换原字符串中的字母位置 int idx = 0; for (char &c : s) { if (isalpha(c)) { c = letters[idx++]; } } cout << s << endl; return 0; } // 64 位输出请用 printf("%lld")