s=list(map(int,input()))
i=0
ans=0
a=s[i]
b=s[i]
while True:
  try:
    a=s[i]
    i=i+1
    if a != b:
        del s[i]
        del s[i-1]
        ans=ans+2
        if i>2:
            i=i-3
        else:
            i=0
    b=a
  except:
      break
print(ans)