s = input() n = len(s) ans = 0 for i in range(n - 2): t = s[i:i+3] if len(set(t)) !=2: continue if t[0] == t[1] or t[1] == t[2]: ans += 1 print(ans)