N=input()
cube=[]
ans=0
cube = [int(x) for x in list(str(N))]
while True:
      if sum(cube)==len(cube) or sum(cube)==0 or cube ==[]:
          break
      else:
         for i in range(len(cube)-1):
           if cube[i-1]-cube[i]==1 or cube[i-1]-cube[i]==-1:
             del cube[i-1]
             del cube[i]
             ans+=2
             break
print(ans)
