Problem 18 solved