#include<stdio.h> #include<stdlib.h> #include<cstring> int main() { char *str=(char*)malloc (sizeof(char));//char*之前必须分配内存 while(scanf("%s",str)!=EOF)//注意此地不能用&str { char tem; int len =strlen(str); for (int i=len-1;i>-1;i--) { printf("%c",str[i]); } printf(" "); } return 0; }