#include <bits/stdc++.h>
typedef struct stack {
  int size;
  int count;
  char data[100000];
  char *top;
} stack;
void initialize_stack(stack *stk) {
  stk->count = 0;
  stk->size = 100000;
  stk->top = &(stk->data[100000]);
}
void push(stack *stk, int elem) {
  if (stk->count >= stk->size) {
    fprintf(stderr, "Error: stack overflow. (x=%c)\n", elem);
    exit(1);
  } else {
    stk->top--;
    *(stk->top) = elem;
    stk->count++;
  }
}
char pop(stack *stk) {
  char latest;
  if (stk->count <= 0) {
    fprintf(stdout, "Error: stack underflow.\n");
    exit(1);
  } else {
    latest = *(stk->top);
    stk->top++;
    stk->count--;
    return latest;
  }
}
int main(void) {
  stack cube;
  char arr[100000];
  int i = 0, count = 0;
  initialize_stack(&cube);
  scanf("%s", arr);
  while (arr[i] != '\0') {
    if (arr[i] == *(cube.top)) {
      pop(&cube);
      count++;
    } else {
      push(&cube, arr[i]);
    }
    i++;
  }
  printf("%d", 2 * count);
  return 0;
}
