s = gets.chomp.split("")
w = 0
ans = 0
for i in 0..s.length - 1
 if s[i] == "W"
   w += 1
 end
end 
bw = []
for i in 0..s.length - 1
 if s[i] == "B"
   bw.push(w)
 else
   w -= 1
 end
end
for i in 0..bw.length - 1
  ans += bw[i]
end

puts ans