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