ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

S=input()
N=len(S)

buf = []
ans = 0
for s in S:
    if buf:
        if buf[-1] != s:
            buf = buf[:-1]
            ans += 2
        else:
            buf += s
    else:
        buf += s

print(ans)
