solve problem 18