#include <stdio.h>
#define MAXLINELENGTH 80
int main () {
char line[MAXLINELENGTH];
int ch, length;
while ( (ch = getchar ()) != EOF ) {
length = 0; /* Read a line */
while ( length < MAXLINELENGTH ) {
if (ch == '\n') break;
line[length++] = ch;
if ( (ch = getchar ()) == EOF ) break;
}
while ( length > 0 ) { /* Print the line reversed */
putchar ( line[--length] );
}
putchar ( '\n' );
}
return 0;
}
/*
This is a test
tset a si sihT
and so is this
siht si os dna
What about EOF
FOE tuoba tahW
Under Unix an EOF can be supplied by entering Cntrl-D
Under Unix a program can be terminated by entering Cntrl-C
Under Unix a program can be suspended by entering Cntrl-Z
*/