Solved problem 35 on PE