#include <bits/stdc++.h>
int main() {
  char S[100000];
  int len;
  int has_changed;
  int i, j, i_start;
  int result;
  scanf("%s", S);
  len = strlen(S);
  result = 0;
  do {
    has_changed = 0;
    i_start = 0;
    while (1) {
      for (i = i_start; i < len; i++) {
        if (S[i] != '2') {
          break;
        }
      }
      if (i >= len - 1) {
        break;
      }
      for (j = i + 1; j < len; j++) {
        if (S[j] != '2') {
          break;
        }
      }
      if (j >= len) {
        break;
      }
      if (S[i] != S[j]) {
        result += 2;
        S[i] = '2';
        S[j] = '2';
        has_changed = 1;
        i_start = j + 1;
      } else {
        i_start = j;
      }
    }
  } while (has_changed == 1);
  printf("%d\n", result);
  return 0;
}
