S = gets.chomp.chars

ans = 0
cnt = 0 # The count of white on right in each step i.

N = S.size
(N - 1).downto(0).each do |i|
  c = S[i]
  if (c == 'W') 
    cnt += 1
  else # c == 'B'
    ans += cnt
  end
end

p ans