Solution for problem 43