scan :: String -> Int
scan l = iter 0 0 (reverse l) where
    iter ac _ [] = ac
    iter ac c (x:xs)
        | x =='B' = iter (ac+c) c xs
        | x =='W' = iter ac (c+1) xs

main :: IO() 
main = do
    s <- getLine
    let ans = scan s
    print ans