/*
 *	This is a filter to reverse the order of characters on each input line.
 */

#define MAXLINELEN 256		/* max number of printable chars per line */

main()
{
	char buf[MAXLINELEN];	/* line buffer */
	char *cp;		/* points to where to put the next input char */
	int ch;			/* current input char under inspection */

	cp = buf;

	while ((ch = getchar()) != EOF) {
		if (ch == '\n') {
			/* remember - cp points one last the last char in buf */
			while (cp > buf) putchar(*--cp);
			/* at end of above loop, cp == buf */
			putchar('\n');
		} else {
			/* regular char - put it in the buffer */
			*cp++ = ch;
		}
	}

	exit(0);
}
