main = do
    ss <- getLine
    print $ solve ss 0 0 

solve :: String -> Int -> Int -> Int
solve x b_prev temp_sum
    | x == [] = temp_sum
solve (x:xs) b_prev temp_sum 
    | x == 'B' = solve xs (b_prev+1) temp_sum
    | x == 'W' = solve xs b_prev (temp_sum + b_prev)