S = eval(input())

tmp = ''



ret = 0

for s in S:

    if len(tmp) and tmp[-1] != s:

        ret += 1

        tmp = tmp[:-1]

    else:

        tmp += s



print((ret * 2))

S = eval(input())



print((2 * min(S.count('0'), S.count('1'))))

S = eval(input())
tmp = ""
ret = 0
for s in S:
    if len(tmp) and tmp[-1] != s:
        ret += 1
        tmp = tmp[:-1]
    else:
        tmp += s
print((ret * 2))

S = eval(input())
print((2 * min(S.count("0"), S.count("1"))))

-tmp = "" -ret = 0 -for s in S: -    if len(tmp) and tmp[-1] != s: -        ret += 1 -        tmp = tmp[:-1] -    else: -        tmp += s -print((ret * 2)) +print((2 * min(S.count("0"), S.count("1"))))