Solve #44 in Haskell.