s = gets
c = 0

f = 0
while true
  for i in 1...s.length
    j = s.length - i
    if s[j] == 'W' && s[j-1] == 'B'
      c += 1 
      s[j] = 'B'
      s[j-1] = 'W'
    end
  end
  break if f == c
  f = c
end

puts f
