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