program sample
    implicit none
    character(200000)::s,t
    integer(8) :: i,j,m,n,a,b
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) s
    n=len_trim(s)
    if (mod(n,2)==0)then
        m=n/2
    else
        m=(n+1)/2
    end if
    a=0
    b=0
    do i=1,n
        if (s(i:i) .eq. 'W')then
            b=b+a
        else
            a=a+1
        end if
    end do


    write(*,*) b
  
    stop
end program sample
  

