s = gets.chomp
n = s.length
ans = 0
i=0
loop do
    if s[i]=='B' && s[i+1]=='W'
        s[i]='W'
        s[i+1]='B'
        ans+=1
        i = [0,i-1].max
        next
    end
    i+=1
    break if i>=n-1
end
puts ans