added solution to exercise 9