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