change exit condition to EOF. Add input file (in.txt) to read from instead of keyboard input from the terminal.