s = gets
num = 0
wcnt = s.count('W')
s1 = 'B' * (s.size - wcnt)

while s != s1 do
s.slice!(/^W+/)
(s.size - 1).times do |i|
    if s[i, 2] == 'BW' 
      s[i, 2] = 'WB'
      num += 1
    end
  end
end

puts num