solved problem 18