#include <iostream> #include <algorithm> using namespace std; bool compare(char a, char b) { if (a >= 'a' && a <= 'z') a = 'A' + a - 'a'; if (b >= 'a' && b <= 'z') b = 'A' + b - 'a'; return a < b; } bool isLetter(char c) { if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) return true; else return false; } int main() { string a; while (getline(cin,a) ) { // 注意 while 处理多个 case // cout << a + b << endl; string b; for (int i = 0; i < a.size(); i++) { if (isLetter(a[i])) b += a[i]; } stable_sort(b.begin(), b.end(), compare); int j = 0; for (int i = 0; i < a.size(); i++) { if (isLetter(a[i])) { a[i] = b[j]; j++; } } cout<<a<<endl; } } // 64 位输出请用 printf("%lld")