s=gets.chomp
check=true
change=0
while check
  check=false
  (s.size-1).times{|i|
    if s[i]=="B"&&s[i+1]=="W"
      s[i],s[i+1]=s[i+1],s[i]
      change+=1
      check=true
    end
  }
  unless check then break end
end

puts change
