s=[*input()]
n1=[*'01']
n2=[*'10']
judge=True
max_length=len(s)
while judge:
  judge = False
  length = len(s)
  for i in range(1,length):
    if s[i-1:i+1]==n1 or s[i-1:i+1]==n2:
      del s[i]
      del s[i-1]
      i+=2
      judge = True
print(max_length-len(s))