S = str(input())
stack = []
N = len(S)
for i, s in enumerate(S):
  if i == 0:
    stack.append(s)
    else:
      if len(stack) == 0:
        stack.append(s)
        else:
          if s != stack[-1]:
            tmp = stack.pop()
            else:
              stack.append(s)
print(N - len(stack))
