answer = [20104,20063,19892,20011,19874,20199,19898,20163,19956,19841] main = do (x:_:xs) <- getLine let muwi = flip map ['0'..'9'] $ \z -> length $ filter (== z) (x:xs) diff = zip [0..] $ zipWith (-) muwi answer (o1, o2) = foldr f (-1,-1) diff where f (ind,v) (p1,p2) | v > 0 = (ind, p2) | v < 0 = (p1, ind) | otherwise = (p1, p2) putStrLn $ show o1 ++ " " ++ show o2