S = eval(input())

List = list(S)

Length = len(List)

Sum = 0

for item in List:

  Sum += int(item)

Answer = Length - abs(2*Sum - Length)

print(Answer)
s = eval(input())

Answer = min(s.count('0'),s.count('1'))*2

print(Answer)
S = eval(input())
List = list(S)
Length = len(List)
Sum = 0
for item in List:
    Sum += int(item)
Answer = Length - abs(2 * Sum - Length)
print(Answer)

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

-S = eval(input()) -List = list(S) -Length = len(List) -Sum = 0 -for item in List: -    Sum += int(item) -Answer = Length - abs(2 * Sum - Length) +s = eval(input()) +Answer = min(s.count("0"), s.count("1")) * 2