#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { cin.sync_with_stdio(0); cin.tie(0); string str; while (cin >> str) { vector<string>alpha; vector<char>num; string tmp = ""; for (int i = 0; i<str.length(); i++) { if (!isalpha(str[i])) { if (tmp != "") { reverse(tmp.begin(), tmp.end()); alpha.push_back(tmp); tmp = ""; } num.push_back(str[i]); } else { tmp += str[i]; if (i == str.length()-1) { reverse(tmp.begin(), tmp.end()); alpha.push_back(tmp); } } } reverse(num.begin(), num.end()); for (int i = 0; i<str.length(); i++) { if (!isalpha(str[i])) { cout << num[0]; num.erase(num.begin()); } else { cout << alpha[0]; i += alpha[0].length()-1; alpha.erase(alpha.begin()); } } cout << "\n"; } }