s = input()
length=len(s)
l = int(len(s)/2)
def erase_01_10(moji):
  if moji.count('01')>0:
    moji = moji.replace('01','')
  elif moji.count('10')>0:
    moji = moji.replace('10','')
  return moji
for i in range(l):
  if s == erase_01_10(s):
    break
  s = erase_01_10(s)
print(length-len(s))