Add solution to exercise 2 (day18)