program sixth
  implicit none
  character(200000) :: s
  integer :: n, c, i, k

  read(*,*) s

  n = len(trim(s))
  c = 0

  k = 0
  do i = 1, n
     if (s(i:i) == 'W') then
        c = c +  k
     else
        
        k = k + 1
     end if

  end do

  write(*,*) c
  stop
end program sixth
