Adding problem 8 solution.