R=range J=lambda:list(map(int,input().split())) S=input() print(sum(1 for i in R(len(S)-2)if S[i]==S[i+1]!=S[i+2]or S[i]!=S[i+1]==S[i+2]))