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