S = input() ans = 0 for i in range(len(S)-2): if (S[i] == S[i+1] or S[i+1] == S[i+2]) and S[i] != S[i+2]: ans += 1 print(ans)