#include<stdio.h> #include<string.h> int main() { char s[10010]; while(gets(s)!=NULL){ int len,i,start,end,j; len=strlen(s); int count=0; for(i=0;i<len;++i){ if(s[i]!=' '){ start=i; while(s[i]!=' '&&i<len){ i++; } end=i-1; if(count!=0) printf(" "); for(j=end;j>=start;j--){ printf("%c",s[j]); } count=1; } } printf("\n"); } } |
Double click to view unformatted code.