#include<iostream> #include<cstdio> using namespace std; int main() { string s; while(getline(cin, s)) { string str; for(int i = 0; i < s.length(); i++) if((s[i] <= 'z' && s[i] >= 'a') || (s[i] <= 'Z' && s[i] >= 'A')) str = s[i] + str; else { cout << str << s[i]; str.clear(); } cout << str << endl; } return 0; } |
Double click to view unformatted code.