S = input() ret = 0 for i in range(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]): ret += 1 print(ret)