from collections import deque

s = input()
cnt = 0
i = 0
n = len(s)
stack = deque()
while i < n:
    stack.append(s[i])
    while len(stack) > 0 and i < n and stack[-1] == s[i]:
        stack.pop()
        i += 1
        cnt += 2
    i += 1
print(cnt)
