main = do
 s <- getLine
 print $ solve s

solve :: String -> Integer
solve = recur (0,0)

recur :: (Integer,Integer) -> String -> Integer
recur (b,w) [] = 0
recur (b,w) ('B':xs) = recur (b+1,w) xs
recur (b,w) ('W':xs) = b + recur (b,w+1) xs 