s=input() x = 0 for i in range(len(s)-2): z = s[i:i+3] x += (z[0]==z[1]) + (z[1] == z[2]) - 2*(z[0] == z[1] == z[2]) print(x)