finished reading function for problem 11