count = 0
get_string = gets.chomp
last_index = get_string.length - 1
(-(last_index-1)..0).each do |minor_index|
  index = minor_index.abs
  next if get_string[index] == 'W'
  # 右側文字取得
  s = get_string[index + 1 .. last_index]
  # Wの文字数を数える
  count += s.scan(/[W]/).length
end
puts count
