from collections import Counter

s = str(eval(input()))

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

print((len(s)-abs(s.count("1")-s.count("0"))))
from collections import Counter

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

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

-from collections import Counter -