Added solution to problem 18.