fork download
  1. import Data.List
  2. import Data.Ord
  3. import Control.Monad
  4.  
  5. main = printL . reverse . sortBy (comparing snd) . countUp . replicateM 2 $ ["○","○","○","△","△","☓"]
  6. -- 文字コードの問題
  7. where printL = mapM (\(x,n) -> putStr (concat x) >> putStr " = " >> print n )
  8. countUp = map (\x -> (head x, length x)) . group . sort . map sort
  9.  
Success #stdin #stdout 0s 6276KB
stdin
Standard input is empty
stdout
△○ = 12
○○ = 9
○☓ = 6
△☓ = 4
△△ = 4
☓☓ = 1