S = input() def func(S): return S[0] == S[1] and S[1] != S[2] or S[0] != S[1] and S[1] == S[2] print(sum(func(S[i:i+3]) for i in range(len(S)-2)))