Solved problem 46 on PE