combi :: Integral a => a -> a
combi n = n * (n - 1) `div` 2

solve :: Integral a => String -> a
solve = sol 0 0 . reverse
    where
        sol w a [] = a
        sol w a (c : cs)
            | c == 'w'          = sol (w + 1) a cs
            | c == 'c' && w > 0 = sol w (a + combi w) cs
            | otherwise         = sol w a cs

main :: IO ()
main = print . solve =<< getLine