S = list(input())
for i in range(len(S)):
    S[i] = int(S[i])
    if S[i] == 0:
        S[i] = -1

now = S[0]
cnt = 1
ans = 0
for i in range(1, len(S)):

    if cnt > 0:
        if S[i] == now:
            ans += 2
            cnt -= 1
            now *= -1
        else:
            cnt += 1
    else:
        now = S[i]
        cnt += 1

print(ans)