#include <stdio.h> #include <string.h>
#define MAX_LEN_INPUT 1002
int main(int argc, char* argv[]) { char inLine[MAX_LEN_INPUT] = {0}; int len; char temp;
do{
// gets is not recommended and forbidden in some compilers
fgets(inLine, MAX_LEN_INPUT, stdin);
// the methd of dealing with '\n' is different between fgets and gets
// fgets will reserve '\n'; gets will remove '\n'
len = strlen(inLine);
for(int i = 0; i < (len-1)/2; i++)
{
temp = inLine[len - i - 2];
inLine[len-i -2] = inLine[i];
inLine[i] = temp;
}
fputs(inLine, stdout);
}while(0);
return 0;
}