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