import Data.List
main=do
    s<-getLine
    print $ sum $ f s
f s
    | null s = []
    | null ss = []
    | null sss = []
    | otherwise =  (length bs * length ws) : f (bs++r)
    where
    ss = dropWhile (=='W') s
    (bs,sss) = span (=='B') ss
    (ws,r) = span (=='W') sss