solve exercise 18.12