S = input() i = 0 ans = 0 while i < len(S) - 2: if (S[i] == S[i+1] or S[i+1] == S[i+2]) and not S[i] == S[i+1] == S[i+2]: ans += 1 i += 1 print(ans)