Added correct solution for problem 18.