#include <stdio.h> #include <string.h> #include <ctype.h> int main(void) { char st[1001]; int i,j,n,len,k=0,start=0; while (gets(st)) { len = strlen(st); for (i=0; i<len; i++) { if ((isalpha(st[i]) == 0) || (i==len-1)) { if (i==len-1) k = i; else k = i-1; for (j=k; j>=start; j--) printf("%c", st[j]); if (isalpha(st[i]) == 0) printf("%c", st[i]); start = i+1; } } printf("\n"); start = 0; k = 0; } } |
Double click to view unformatted code.