Skip to content

Instantly share code, notes, and snippets.

@rxw1
Created November 12, 2020 02:04
Show Gist options
  • Save rxw1/6c1ccb788331c8ca6ba7a92338afd692 to your computer and use it in GitHub Desktop.
Save rxw1/6c1ccb788331c8ca6ba7a92338afd692 to your computer and use it in GitHub Desktop.
import Data.List
import Data.Ord
main = interact $ (=<<) (\x -> show (length x) ++ " " ++ head x ++ "\n")
. sortBy (flip $ comparing length)
. group . sort
. words
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment