#include<bits/stdc++.h> using namespace std; long long a[51]; int main() { string h; while(getline(cin,h)) { string h1=""; for(int i=0;i<h.length();i++) { if((h[i]>='a'&&h[i]<='z')||(h[i]>='A'&&h[i]<='Z')) { h1+=h[i]; } else { reverse(h1.begin(),h1.end()); cout<<h1<<h[i]; h1=""; } } reverse(h1.begin(),h1.end()); cout<<h1<<endl; } } |
Double click to view unformatted code.