local t = {}
while true do
	local c = io.read(1)
	if c == 'B' or c == 'W' then
		table.insert(t, c)
	else
		break
	end
end
local rmax = #t
local count = 0
for i=#t,1,-1 do
	local c = t[i]
	if c == 'B' then
		count = count + rmax - i
		rmax = rmax - 1
	end
end
print(count)
