solve exercise 22.17