correct solution for problem 35