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