import sys
input = sys.stdin.readline

count0=0
count1=0
lastElm=-1
S=[]
s=input()
for c in s:
        S.append(c)
S.pop(-1)
lenS = len(S)
if lenS==1:
        print(0)
        exit()
S.sort()
for i in range(lenS):
        if i==0:
                count0=S.count("0")
                count1=S.count("1")
                if count0 == 0 or count1==1:
                        print(0)
                        exit()
        else:
                if lastElm == "0":
                        count0 -= 1
                elif lastElm == "1":
                        count1 -= 1

        if count0 == count1:
                print(count0*2)
                exit()
        else:
                if S[lenS//2] == "1":
                        lastElm = S[-1]
                        S.pop(-1)
                else:
                        lastElm = S[0]
                        S.pop(0)