s = gets.chomp

count = 0

def flip(s, i)
  s[i] = "W"
  s[i+1] = "B"
  s
end

while s.include?("BW") do
  (s.length - 1).step(0, -1) do |i|
    if s[i] == "W" && s[i-1] == "B"
      count += 1
      s.replace(flip(s, i-1))
      break
    end
  end
end

puts count