inp = input()
len_1st = len(inp)

inf = 10 ** 5
for i in range(inf):
  inp = inp.replace('10','')  
  inp = inp.replace('01','')  
  
  cnt_01 = inp.count('01')
  cnt_10 = inp.count('10')
  if (cnt_01 == 0) & (cnt_10 == 0):
    break
  
len_after = len(inp)
print(len_1st - len_after)