s=gets.chomp
check=true
change=0
while check
  check=false
  if s.include?("BW")
    i=s.index("BW")
    s[i],s[i+1]=s[i+1],s[i]
    change+=1
    check=true
  end
  unless check then break end
end

puts change
