Solve Exercise 5-7: Improved readlines()