s=input()
line=[int(c) for c in s]
length=len(line)
while 1:
  for i in range(len(line)-1):
    if line[i]!=2 and line[i]!=line[i+1]:
      line[i]=2
      line[i+1]=2
  if 2 in line:
    line=[i for i in line if i!=2]
  else:
    break
print(length-len(line))