S = eval(input())



l = []

for s in S:

	si = int(s)

	if not l:

		l.append(si)

	else:

		if (l[-1] + si) & 1:

			l.pop()

		else:

			l.append(si)

print((len(S) - len(l)))

from collections import defaultdict as dd



# お約束

INF = float("inf")

MOD = int(1e9 + 7)

def int1(n):

    return int(n) - 1

def parse(*args):

    return tuple(p(v) for p, v in zip(args, input().split()))



# エントリーポイント

def main():

    S = eval(input())

    c = [0, 0]

    for s in S:

        c[s == "1"] += 1

    print((len(S) - abs(c[0] - c[1])))



main()

S = eval(input())
l = []
for s in S:
    si = int(s)
    if not l:
        l.append(si)
    else:
        if (l[-1] + si) & 1:
            l.pop()
        else:
            l.append(si)
print((len(S) - len(l)))

from collections import defaultdict as dd

# お約束
INF = float("inf")
MOD = int(1e9 + 7)


def int1(n):
    return int(n) - 1


def parse(*args):
    return tuple(p(v) for p, v in zip(args, input().split()))


# エントリーポイント
def main():
    S = eval(input())
    c = [0, 0]
    for s in S:
        c[s == "1"] += 1
    print((len(S) - abs(c[0] - c[1])))


main()

-S = eval(input()) -l = [] -for s in S: -    si = int(s) -    if not l: -        l.append(si) -    else: -        if (l[-1] + si) & 1: -            l.pop() -        else: -            l.append(si) -print((len(S) - len(l))) +from collections import defaultdict as dd + +# お約束 +INF = float("inf") +MOD = int(1e9 + 7) + + +def int1(n): +    return int(n) - 1 + + +def parse(*args): +    return tuple(p(v) for p, v in zip(args, input().split())) + + +# エントリーポイント +def main(): +    S = eval(input()) +    c = [0, 0] +    for s in S: +        c[s == "1"] += 1 +    print((len(S) - abs(c[0] - c[1]))) + + +main()