import sys
input = sys.stdin.readline

S = list(map(int, input().replace('\n', '')))

N = len(S)
stack = []
cnt = 0
index = N - 1
while index > -1:
    print(index, S, stack)
    if(len(stack) == 0):
        stack.append(S.pop())
        index -= 1
    else:
        if stack[-1] != S[index]:
            stack.pop()
            S.pop(index)
            index -= 1
            cnt += 2
        else:
            stack.append(S.pop())
            index -= 1
print(cnt)