#include <bits/stdc++.h> using namespace std; int main() { string s; while(getline(cin,s)) { //cout<<s; stringstream ss; ss<<s; int first=0; string p; while(ss>>p) { reverse(p.begin(),p.end()); if(first==0) { first=1; cout<<p; } else { cout<<" "<<p; } } cout<<endl; } return 0; } |
Double click to view unformatted code.