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)

if len(S)==1:
        print(0)
        exit

for i in range(len(S)):
        if i==0:
                count0=S.count("0")
                count1=S.count("1")
        else:
                if lastElm == "0":
                        count0 -= 1
                elif lastElm == "1":
                        count1 -= 1
        if count0 == count1:
                print(count0*2)
                exit()
        else:
                lastElm = S[-1]
                S.pop(-1)