Solve #14 in Haskell.