from collections import deque

deq=deque()

s=eval(input())

n=len(s)

for i in s:

    if len(deq)==0:

        deq.append(i)

        continue

    x=deq.pop()

    if x==i:

        deq.append(x)

        deq.append(i)

print((n-len(deq)))
from collections import Counter

s=eval(input())

c=Counter(s)

print((min(c["0"],c["1"])*2))
from collections import deque

deq = deque()
s = eval(input())
n = len(s)
for i in s:
    if len(deq) == 0:
        deq.append(i)
        continue
    x = deq.pop()
    if x == i:
        deq.append(x)
        deq.append(i)
print((n - len(deq)))

from collections import Counter

s = eval(input())
c = Counter(s)
print((min(c["0"], c["1"]) * 2))

-from collections import deque +from collections import Counter -deq = deque() -n = len(s) -for i in s: -    if len(deq) == 0: -        deq.append(i) -        continue -    x = deq.pop() -    if x == i: -        deq.append(x) -        deq.append(i) -print((n - len(deq))) +c = Counter(s) +print((min(c["0"], c["1"]) * 2))