add solution to problem 18