import sys
input  = sys.stdin.readline

S = input()
N = len(S)

while True:
  n = len(S)
  S = S.replace('10','')
  if n == len(S):
    break
while True:
  n = len(S)
  S = S.replace('01','')
  if n == len(S):
    break
print(N-len(S))
