input = gets.to_s
arrayInput = []
arrayInput =  input.split("")
loopTimes = 0

existBW = true

while (existBW) do
 existBW = false
 for times in 0..arrayInput.size - 1 do
  if arrayInput[times] == "B" && arrayInput[times + 1] == "W" then
    arrayInput[times] = "W"
    arrayInput[times + 1] = "B"
    loopTimes = loopTimes + 1
    existBW = true
  end
 end
end

puts loopTimes