line=input()
while 1:
  line_1=line[:len(line)//2]
  line_2=line[((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','')
  lines=line_1+line_2
  break
line=[int(c) for c in lines]
length=len(line)
while 1:
  for i in range(len(line)-1):
    if line[i]!=2 and line[i]!=line[i+1]:
      line[i]=2
      line[i+1]=2
  if 2 in line:
    line=[i for i in line if i!=2]
  else:
    break
print(length-len(line))