added code for problem 46