S = str(input())

ans = len(S)
for i in range(len(S)):
  if len(S) == len(S.replace("01","")) and len(S) == len(S.replace("10","")):
    break
  else:
    S = S.replace("01","")
    S = S.replace("10","")

print(ans-len(S))
