Solve problem 2 of Ninety-Nine Haskell Problems.