#include "stdlib.h" #include "algorithm" #include "iostream" #include <cstdio> #include "string" #include <iomanip> #include <map> #include "math.h" using namespace std; int main() { string str; int k; while (getline(cin,str)) { for (int i = 0; i<str.length(); i++) { k = 0; if (isalpha(str[i])) { for (int j = i; j<str.length(); j++) { if (isalpha(str[j]))k++; else break; } for (int j = i + k - 1; j >= i; j--)cout << str[j]; i = i + k - 1; } else cout << str[i]; } cout << endl; } return 0; } |
Double click to view unformatted code.