program prob5
    implicit none
    character(len=200000) :: S
    integer(8) :: ans, cnt, i
    read(*,*) S

    cnt = 0
    ans = 0
    do i = 1, len_trim(S)
        if(S(i:i) == 'W') then
            ans = ans + cnt
        else
            cnt = cnt + 1
        end if
    end do

    write(*,*) ans

    stop
contains
end program prob5