solve exercise 18.27