def count_0_and_1(S):

    cnt_0 = 0

    cnt_1 = 0

    for i in S:

        if i == '0':

            cnt_0 += 1

        if i == '1':

            cnt_1 += 1

    return cnt_0, cnt_1





S = eval(input())

minRB = min(count_0_and_1(S))



print((2*minRB))
def unification(S):

    cnt_0 = S.count('0')

    cnt_1 = S.count('1')

    return 2 * min(cnt_0, cnt_1)



S = eval(input())

print((unification(S)))
def count_0_and_1(S):
    cnt_0 = 0
    cnt_1 = 0
    for i in S:
        if i == "0":
            cnt_0 += 1
        if i == "1":
            cnt_1 += 1
    return cnt_0, cnt_1


S = eval(input())
minRB = min(count_0_and_1(S))
print((2 * minRB))

def unification(S):
    cnt_0 = S.count("0")
    cnt_1 = S.count("1")
    return 2 * min(cnt_0, cnt_1)


S = eval(input())
print((unification(S)))

-def count_0_and_1(S): -    cnt_0 = 0 -    cnt_1 = 0 -    for i in S: -        if i == "0": -            cnt_0 += 1 -        if i == "1": -            cnt_1 += 1 -    return cnt_0, cnt_1 +def unification(S): +    cnt_0 = S.count("0") +    cnt_1 = S.count("1") +    return 2 * min(cnt_0, cnt_1) -minRB = min(count_0_and_1(S)) -print((2 * minRB)) +print((unification(S)))