S = input() ans = 0 if len(S) < 3: print(ans) exit() for i in range(len(S)-2): s = set(S[i:i+3]) if len(s)==2: ans += 1 print(ans)