Began a solution for problem 18