Solution for problem 20