solve :: String -> Integer -> Integer solve [] _ = 0 solve ('c':xs) c = c * (c - 1) `div` 2 + solve xs c solve ('w':xs) c = solve xs (c - 1) solve (_:xs) c = solve xs c main = do str <- getLine let count = fromIntegral $ length (filter (=='w') str) print $ solve str count