main :: IO () main = do s_ <- getLine let s = filter (\x -> x == 'c' || x== 'w') s_ putStrLn . show $ f s f :: String -> Int f ('c':xs) | length s < 2 = 0 | otherwise = bc (length s) 2 + f xs where s = filter ((==) 'w') xs f (_:xs) = f xs f _ = 0 bc :: Int -> Int -> Int bc _ 0 = 1 bc n k | n < 0 = 0 | n == k = 1 | otherwise = bc (n - 1) (k - 1) + bc (n - 1) k