#include <bits/stdc++.h>
int main() {
  char s[100000];
  int len;
  int n[100000];
  int i, j, k;
  int cnt;
  int sum;
  scanf("%s", s);
  len = strlen(s);
  do {
    for (i = 0; i < len; i++) {
      if (s[i] != s[i + 1]) {
        cnt += 2;
        for (j = i + 2; j < len; j++) {
          s[j - 2] = s[j];
        }
        s[len - 2] = NULL;
        s[len - 1] = NULL;
        len = strlen(s);
      }
    }
    sum = 0;
    for (k = 0; k < len; k++) {
      n[k] = s[k] - '0';
      sum += n[k];
    }
  } while ((sum != 0) && (sum != len));
  printf("%d", cnt);
}
