s=eval(input());print((sum([0,1][s[i]!=s[i-1]]for i in range(1,len(s)))))
s=eval(input());print((s.count('WB')+s.count('BW')))
s = eval(input())
print((sum([0, 1][s[i] != s[i - 1]] for i in range(1, len(s)))))

s = eval(input())
print((s.count("WB") + s.count("BW")))

-print((sum([0, 1][s[i] != s[i - 1]] for i in range(1, len(s))))) +print((s.count("WB") + s.count("BW")))