Here is exercise 5 from parprog