Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Reads a set of strings separated by newlines from stdin, sorts them
- -- by length in descending order, writes them to stdout.
- import Data.List
- import Data.Function
- main :: IO ()
- main = do
- input <- getContents
- mapM_ putStrLn $ sortBy (flip (on compare length)) (lines input)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement