Solution for problem 48