Answer:
#include <stdio.h>
#define MAX_CH 256
int main(void) {
int ch, i, length;
char string[MAX_CH];
for (;;) {
for (i = 0; i < MAX_CH; i++) {
if ((ch = getchar()) == EOF || (ch == '\n')) break; string[i] = ch; }
length = i;
if (length == 0) { break; }
for (i = 0; i < length; i++) { putchar(string[length - i - 1]); }
putchar('\n');
}
return 0;
}
Explanation: