You are viewing a single comment's thread. Return to all comments →
Haskell point-free:
module Main where import Control.Monad (replicateM) import qualified Data.Map as M solve :: [String] -> Int solve = M.foldr ((+) . abs) 0 . foldr (M.unionWith (-)) M.empty . map (M.fromListWith (+) . (flip zip (repeat 1))) main :: IO () main = replicateM 2 getLine >>= print . solve
Seems like cookies are disabled on this browser, please enable them to open this website
Making Anagrams
You are viewing a single comment's thread. Return to all comments →
Haskell point-free: