from collections import deque
S=input().strip()
N=len(S)

a=[0 if x == '0' else 1 for x in S]

q = deque()
for i in a:
    if q:
        if q[-1] != i:
            q.pop()
        else:
            q.append(i)
    else:
        q.append(i)

print(N-len(q)) from collections import deque S=input().strip() S input().strip() ().strip () input strip N=len(S) N len(S) len S 0 if x == '0' else 1 for x in S for x in S x S for x in S 0 if x == '0' else 1 x == '0' x '0' 0 1 a=[0 if x == '0' else 1 for x in S] a [0 if x == '0' else 1 for x in S] q = deque() q deque() deque for i in a:
    if q:
        if q[-1] != i:
            q.pop()
        else:
            q.append(i)
    else:
        q.append(i) i a if q:
        if q[-1] != i:
            q.pop()
        else:
            q.append(i)
    else:
        q.append(i) q if q[-1] != i:
            q.pop()
        else:
            q.append(i)
     q[-1] != i q[-1] q -1 i q.pop() q.pop q pop q.append(i) q.append q append i q.append(i) q.append q append i print(N-len(q)) print N-len(q) N len(q) len q S=input().strip() input().strip() S N=len(S) len(S) N q = deque() deque() q a=[0 if x == '0' else 1 for x in S] [0 if x == '0' else 1 for x in S] a
from collections import deque
S=input().strip()
N=len(S)

a=[0 if x == '0' else 1 for x in S]

q = deque()
for i in a:
    if q:
        if q[-1] != i:
            q.pop()
        else:
            q.append(i)
    else:
        q.append(i)

print(N-len(q))
