program pro5
    implicit none
    character(len=2*10**5)::C
    integer(8)::i, b, ans
    read(*,*) C
    b = 0
    ans = 0

    do i = 1, len_trim(C)
        if(C(i:i) .eq. 'W') then
            ans = ans + b
        else
            b = b+1
        end if
    end do

    write(*,*) ans
    stop

end program pro5