s = input()
n = len(s)
old_length=-1
for i in range(n):
  if old_length==len(s):
    break
  old_length=len(s)
  s=s.replace('01','').replace('10','').replace('01','').replace('10','')
print(n-len(s))