S = input() c = 0 for i in range(len(S)-2): s = S[i:i+3] if len(set(s)) ==2 and (s[0] == s[1] or s[1] == s[2]): c += 1 print(c)