line=input()
length=len(line)
while 1:
  line_1=line[:len(line)//2]
  line_2=[len(line)//2+1:len(line)]
  if line_1.count(1)>line_1.count(0):
    line_1.replace('1','')
    line_2.replace('0','')
  else:
    line_2.replace('1','')
    line_1.replace('0','')
  line=line_1+line_2
print(length-len(line))