s=list(map(int,input()))
i=0
ans=0
a=s[i]
b=s[i]
while True:
  try:
    a=s[i]

    if a != b:
        del s[i]
        del s[i-1]
        ans=ans+2
        i=i-3
        a = s[i]
        b = s[i]
    b=a
    i=i+1
  except:
      break
print(ans)