s = gets.chomp

cnt = 0

while true
  if s =~ /\ABW/
    first, latter = s.split(/\ABW+/)
  elsif s =~ /BW+\z/
    first, _latter = s.split(/BW+\z/)
    latter = ''
  else
    first, latter = s.split(/BW+/)
  end

  break unless latter
  first_length = first.length
  latter_length = latter.length
  w_length = s.length - first_length - latter_length - 1
  cnt += w_length
  s = "#{first}#{'W' * w_length}B#{latter}"
end

puts cnt