S=list(input())
N=len(S)
def main():
  ans=0
  i=0
  while len(S)>0 :
    if (S[i]==0 and S[i+1]==1) or (S[i]==1 and S[i+1]==0):
      S.remove(S[i:i+2])
      ans+=1
    else:
      ans=ans
      i+=1
  print(ans)
main()