fork download
  1. main = do cs <- getContents
  2. print $ cnt 'a' $ cs
  3.  
  4. cnt :: Char -> [Char] -> Int
  5. cnt x [] = 0
  6. cnt x (c:cs) = cnt x cs + fromEnum(x==c)
Success #stdin #stdout 0.02s 3592KB
stdin
1234abcaaa
stdout
4