S = eval(input())



print((len([0 for index, c in enumerate(S[1:], 1) if c != S[index - 1]])))

S = eval(input())



print((len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2])))

S = eval(input())
print((len([0 for index, c in enumerate(S[1:], 1) if c != S[index - 1]])))

S = eval(input())
print((len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2])))

-print((len([0 for index, c in enumerate(S[1:], 1) if c != S[index - 1]]))) +print((len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2])))