# Problem C - Unification



# input

s = eval(input())



# initialization

zero_count = 0

one_count = 0



# count

for i in range(len(s)):

    if s[i]=='0':

        zero_count += 1

    else:

        one_count += 1



# output

if zero_count>0 and one_count>0:

    if zero_count>=one_count:

        print((one_count*2))

    else:

        print((zero_count*2))

else:

    print((0))

# Problem C - Unification



# input

S = list(eval(input()))



# initialization

zero_num = 0

one_num = 0



# count

for s in S:

    if s=='0':

        zero_num += 1

    else:

        one_num += 1



# output

if not zero_num>0 or not one_num>0:

    print((0))

else:

    min_ans = min(zero_num, one_num)

    print((min_ans * 2))

# Problem C - Unification
# input
s = eval(input())
# initialization
zero_count = 0
one_count = 0
# count
for i in range(len(s)):
    if s[i] == "0":
        zero_count += 1
    else:
        one_count += 1
# output
if zero_count > 0 and one_count > 0:
    if zero_count >= one_count:
        print((one_count * 2))
    else:
        print((zero_count * 2))
else:
    print((0))

# Problem C - Unification
# input
S = list(eval(input()))
# initialization
zero_num = 0
one_num = 0
# count
for s in S:
    if s == "0":
        zero_num += 1
    else:
        one_num += 1
# output
if not zero_num > 0 or not one_num > 0:
    print((0))
else:
    min_ans = min(zero_num, one_num)
    print((min_ans * 2))

-s = eval(input()) +S = list(eval(input())) -zero_count = 0 -one_count = 0 +zero_num = 0 +one_num = 0 -for i in range(len(s)): -    if s[i] == "0": -        zero_count += 1 +for s in S: +    if s == "0": +        zero_num += 1 -        one_count += 1 +        one_num += 1 -if zero_count > 0 and one_count > 0: -    if zero_count >= one_count: -        print((one_count * 2)) -    else: -        print((zero_count * 2)) +if not zero_num > 0 or not one_num > 0: +    print((0)) -    print((0)) +    min_ans = min(zero_num, one_num) +    print((min_ans * 2))