refactor to store stream reading from
handle two lines of input and an empty file
able to read more than two lines