Add solution for exercise 3 of chapter 8.