# 2019/07/25



s=eval(input())



cnt=0

for e in s:

    if e=='1':cnt+=1

    else:cnt-=1

print((len(s)-abs(cnt)))
s=eval(input())

z=s.count('0')

o=s.count('1')

print((len(s)-abs(z-o)))
# 2019/07/25
s = eval(input())
cnt = 0
for e in s:
    if e == "1":
        cnt += 1
    else:
        cnt -= 1
print((len(s) - abs(cnt)))

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

-# 2019/07/25 -cnt = 0 -for e in s: -    if e == "1": -        cnt += 1 -    else: -        cnt -= 1 -print((len(s) - abs(cnt))) +z = s.count("0") +o = s.count("1") +print((len(s) - abs(z - o)))