S=str(input())
l=list(S)
ilength=len(l)
recon=True
while(recon):
  recon=False
  indeces=[]
  jump=False
  for i in range(len(l)-1):
    if(int(l[i])+int(l[i+1])==1 and not(jump)):
      indeces.append(i)
      indeces.append(i+1)
      i+=1
      recon=True
      jump=True
    else:
      jump=False
  sl=[]
  for i in range(len(l)):
    if(not(i in indeces)): sl.append(l[i])
  l=sl[:]
flength=len(l)
print(ilength-flength)