Solve problem 18