program abc029a
    implicit none
    integer(4):: ind_sum,i,n,wcnt
    character(200000):: s

    read*, s(:)
    n = len_trim(s)

    do while(s(1:1) == 'W')
        s = s(2:)
    end do
    
    ind_sum=0
    wcnt=0
    do i=1,n
        if (s(i:i) == 'W')then
            wcnt=wcnt+1
            ind_sum = ind_sum + i - wcnt
        end if
    end do
    print*, ind_sum
end program abc029a