#include <bits/stdc++.h>
int main(void) {
  char input[100000];
  char stack[100000];
  scanf("%s", input);
  int eraseCnt = 0;
  stack[0] = input[0];
  int sCnt, iCnt;
  for (sCnt = 0, iCnt = 1; input[iCnt] != '\0';) {
    if (stack[sCnt] != input[iCnt]) {
      eraseCnt++;
      if (sCnt == 0) {
        stack[sCnt] = input[iCnt + 1];
        sCnt = 0;
        iCnt = iCnt + 2;
      } else {
        sCnt = sCnt - 1;
        iCnt = iCnt + 1;
      }
    } else {
      stack[sCnt + 1] = input[iCnt];
      sCnt++;
      iCnt++;
    }
  }
  printf("%d", eraseCnt * 2);
  return 0;
}
