#include <iostream> #include <cstdio> #include <cstring> using namespace std; int main(){ char s[110]; while(gets(s)!=NULL){ int len=strlen(s); for(int i=0;i<len;i++){ if(s[i]>='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z'){ char t[110]; int j=0; while(s[i]>='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z'){ t[j++]=s[i++]; } i--; for(int k=j-1;k>=0;k--) cout<<t[k]; }else{ cout<<s[i]; } } cout<<endl; } return 0; } |
Double click to view unformatted code.