solved Problem 18