def main():
  S = input()
  n = len(S)

  while True:
    tmp = S
    S = S.replace('01', '')
    S = S.replace('10', '')
    if tmp == S:
      break

  print(n - len(S))


if __name__ == "__main__":
  main()
