难道是因为\r\n 和 \n的问题吗?
#include <bits/stdc++.h>
using namespace std;
char s[110];
int main() {
fgets(s,110,stdin);
int i = 0,j = 0,n = strlen(s);
for(;i < n && j < n;){
while(j < n && s[j] != ' ') ++j;
for(int k = j - 1;k >= i;--k)
putchar(s[k]);
putchar('\n');
i = j + 1;
j = i;
}
return 0;
}