S = eval(input())

array = []

for i in range(len(S)):

    array.append(S[i])

print((len(S)-abs(array.count('0')-array.count('1'))))
S = eval(input())

print((len(S)-abs(S.count('0')-S.count('1'))))
S = eval(input())
array = []
for i in range(len(S)):
    array.append(S[i])
print((len(S) - abs(array.count("0") - array.count("1"))))

S = eval(input())
print((len(S) - abs(S.count("0") - S.count("1"))))

-array = [] -for i in range(len(S)): -    array.append(S[i]) -print((len(S) - abs(array.count("0") - array.count("1")))) +print((len(S) - abs(S.count("0") - S.count("1"))))