#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<iostream> #include<string> #include<algorithm> #include<vector> #include<set> using namespace std; struct ch { char c; int seq; }; bool compare(ch lhs, ch rhs) { if (tolower(lhs.c) < tolower(rhs.c)) { return true; } else if (tolower(lhs.c) == tolower(rhs.c) && lhs.seq < rhs.seq) { return true; } else { return false; } } int main() { string s; while (getline(cin, s)) { vector<ch> str; set<int> isletter; for (int i = 0; i < s.size(); i++) { if ((s[i] >= 'A' && s[i] <= 'Z') || (s[i] >= 'a' && s[i] <= 'z')) { ch x; x.c = s[i]; x.seq = i; isletter.insert(i); str.push_back(x); } } sort(str.begin(), str.end(), compare); int j = 0; for (int i = 0; i < s.size(); i++) { if (isletter.find(i) != isletter.end()) { s[i] = str[j].c; j++; } } cout << s << endl; } }