program main
	implicit none
    character(2*10**5)::s
    integer::i,len_s,ans,t,u
    t=1
    u=0
    i=1
    ans=0
    read(*,*) s
    len_s=len(s)
    do while(s(i:i)/='')
    	if (s(i:i)=='W')then
        	ans=ans+i-t
            t=t+1
            
        end if
        i=i+1
    end do
    
    write(*,*) ans
    
    stop
end program main
            
            