solve exercise 18.02