S = input()
len_before = len(S)
for i in range(len_before):
  S_after = S.replace('01','').replace('10','')
  if '10' in S_after or '01' in S_after:
    S = S_after
  else:
    break
len_after = len(S_after)
print(len_before - len_after)