Revert 1-16 solution to use `getline` function from textbook.

Since the authors suggest to modify `main`, revert the solution to be
implemented according to these requirements.