Skip to content

Instantly share code, notes, and snippets.

@pogin503
Created June 12, 2012 19:01
Show Gist options
  • Select an option

  • Save pogin503/2919441 to your computer and use it in GitHub Desktop.

Select an option

Save pogin503/2919441 to your computer and use it in GitHub Desktop.
AtCoder #001
{- http://arc001.contest.atcoder.jp/tasks/arc001_1#
他の人のを見たらそれに引きづられて丸パクリになってもうた(汗)
参考ソース: http://arc001.contest.atcoder.jp/submissions/22675#
-}
import Data.List
result = do
s <-getLine
s1 <- getLine
let countList = map (\c -> myCount c s1) "1234"
putStrLn $ show (maximum countList) ++ " " ++ show (minimum countList)
myCount :: Char -> String -> Int
myCount _ [] = 0
myCount c (x:xs) = myCount c xs + if c == x then 1 else 0
main = result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment