s = input() print(sum([len(set(s[t:t+3]))==2 and not s[t]==s[t+2] for t in range(len(s)-2)]))