-- リジャッジ落ち修正 -- putStrLn -> putStr -- Try yukicoder -- author: Leonardone @ NEETSDKASU import qualified Data.Map as Map main = putStr . unlines . solve =<< getLine hoge [] = ["Impossible"] hoge xs = xs solve xs = ans where xm = foldl f Map.empty xs f a x = Map.insertWith (+) x 1 a ans = hoge . map (return.fst) . filter h $ map g ['a' .. 'm'] g c = (c, f xm c) h (c, m) = (13,14) == xx where xx = foldl u (0,0) ['a' .. 'm'] u (a,b) x = case Map.lookup x m of Just k -> (a+1,b+k) Nothing -> (0,0)