#include<stdio.h> #include<string.h> int main() { char str[10000]; while(gets(str)) { int len=strlen(str); int i,cnt,j; for(i=0;i<len;i++) { cnt=0; if((str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&str[i]<='Z')) { for(j=i;j<len;j++) { if((str[j]>='a'&&str[j]<='z')||(str[j]>='A'&&str[j]<='Z')) cnt++; else break; } for(j=i+cnt-1;j>=i;j--) printf("%c",str[j]); i=i+cnt-1; } else { printf("%c",str[i]); } } printf("\n"); } } |
Double click to view unformatted code.