Solution for problem 35