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