#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifndef TRUE
#define TRUE (0==0)
#define FALSE (!TRUE)
#endif


int main(int argc, char **argv) {
  FILE *in;

  int c, i, l;
  char *s, *line;
  char sline[257]; sline[256] = '\0';

  if (argc == 2) {
    in = fopen(argv[1], "rb");
  } else {
    fprintf(stderr, "syntax: revline file.txt > revfile.txt\n");
    exit(1);
  }

  for (;;) {
    line = fgets(sline, 256, in);
    if (line == NULL) break;
    s = strchr(line, '\n'); if (s != NULL) *s = '\0';
    l = strlen(line);
    for (i = 0; i < l/2; i++) {
      c = line[i]; line[i] = line[l-i-1]; line[l-i-1] = c;
    }
    puts(line);
  }

  exit(0);
}
