#include<iostream> #include<string> #include<algorithm> using namespace std; int main(){ string s; while(getline(cin,s)){ string temp=""; for(int i=0;i<s.length();++i){ if(s[i]==' '){ reverse(temp.begin(),temp.end()); cout<<temp; temp=""; cout<<s[i]; } else { temp+=s[i]; } } cout<<endl; } return 0; } |
Double click to view unformatted code.