s = input() ans = 0 for i in range(2, len(s)): if len(set(list(s[i-2:i+1]))) == 2 and s[i-2] != s[i]: ans += 1 print(ans)