# C - Unification



S = str(eval(input()))



zeroCnt = 0

oneCnt = 0

ans = 0

for i in range(len(S)):

    if S[i]=='0':

        if oneCnt==0:

            zeroCnt += 1

        else:

            ans += 2

            oneCnt -= 1

    else:

        if zeroCnt==0:

            oneCnt += 1

        else:

            ans += 2

            zeroCnt -= 1



print(ans)



# C - Unification



S = str(eval(input()))



zeroCnt = S.count('0')

oneCnt = S.count('1')



print((min(zeroCnt, oneCnt)*2))
# C - Unification
S = str(eval(input()))
zeroCnt = 0
oneCnt = 0
ans = 0
for i in range(len(S)):
    if S[i] == "0":
        if oneCnt == 0:
            zeroCnt += 1
        else:
            ans += 2
            oneCnt -= 1
    else:
        if zeroCnt == 0:
            oneCnt += 1
        else:
            ans += 2
            zeroCnt -= 1
print(ans)

# C - Unification
S = str(eval(input()))
zeroCnt = S.count("0")
oneCnt = S.count("1")
print((min(zeroCnt, oneCnt) * 2))

-zeroCnt = 0 -oneCnt = 0 -ans = 0 -for i in range(len(S)): -    if S[i] == "0": -        if oneCnt == 0: -            zeroCnt += 1 -        else: -            ans += 2 -            oneCnt -= 1 -    else: -        if zeroCnt == 0: -            oneCnt += 1 -        else: -            ans += 2 -            zeroCnt -= 1 -print(ans) +zeroCnt = S.count("0") +oneCnt = S.count("1") +print((min(zeroCnt, oneCnt) * 2))