N=input()
cube=[]
ans=0
for i in range(len(N)):
    n=N[i:i+1]
    cube.append(int(n))
while sum(cube)!=len(cube) and sum(cube)!=0 and cube !=[]:
      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)
