s = input()
ls = list(int(s))

ans = 0
lf = [1]*n
while '01' in s or '10' in s:
  for i in range(len(ls)):
    if sum(ls[i:i+2]) == 1:
      lf[i] = 0
      lf[i+1] = 0
      ans += 1
  ls,lf = *[s,f for s,f in zip(ls,lf) if lf[i]>0]
print(ans)