import Data.List import Data.Ord import Control.Monad main = printL . reverse . sortBy (comparing snd) . countUp . replicateM 2 $ ["○","○","○","△","△","☓"] -- 文字コードの問題 where printL = mapM (\(x,n) -> putStr (concat x) >> putStr " = " >> print n ) countUp = map (\x -> (head x, length x)) . group . sort . map sort