import Control.Applicative ((<$>)) import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B main :: IO () main = solve <$> B.getLine >>= print solve :: ByteString -> Int solve = snd . B.foldr f (0, 0) where f x (w, cww) | x == 'w' = (w+1, cww) | x == 'c' = (w, comb w 2 + cww) | otherwise = (w, cww) comb n m | n < m = 0 | m == 0 || n == m = 1 | otherwise = comb (n-1) (m-1) * n `div` m