problem 47 solution