s = gets.chop.split('')

white_count = s.select{ |str| str == "W" }.count

white_dis_sum = 0
s.each_with_index do |v, i|
    white_dis_sum += i if v == "W"
end

diff = white_count * (white_count - 1) / 2

puts white_dis_sum - diff
