program AGC029A
    implicit none
    integer(8)::i,slen,ans,bcount
    character(200000)::S
    read*,S
    slen=len_trim(S)
    ans=0
    bcount=0
    do i=1,slen
        if(S(i:i)=="W")ans=ans+bcount
        if(S(i:i)=="B")bcount=bcount+1
    end do

    print'(i0)',ans
end program AGC029A