a = input()

init_len = len(a)
print(len(a))

while True:
  flg = True
  if a.find("01") > 0:
    a = a.replace("01","")
    flg = False
    
  if a.find("10") > 0:
    a = a.replace("10","")
    flg = False
  
  if flg:
    break
print(str(init_len-len(a)))