added problem 18 solution