3 ms·
Here's the Haskell golf import qualified Data.Map as M import Data.List import Data.Ord countWords :: String -> [String] countWords = map
by tel 13y ago
Here's the Haskell golf
import qualified Data.Map as M
import Data.List
import Data.Ord
countWords :: String -> [String]
countWords = map fst . take 10
. sortBy (comparing snd)
. M.toList . M.fromListWith (+) . map (\w -> (w, 1))
. words