#include <bits/stdc++.h>
int main() {
  char a[150000];
  int b[150000], c[150000];
  int k, i;
  scanf("%s", a);
  int l = strlen(a);
  for (int i = 0; i < l; i++) {
    b[i] = a[i] - 48;
  }
  c[0] = b[0];
  int cnt = 0, ans = 1;
  for (int i = 1; i < l; i++) {
    if (b[i] == c[cnt]) {
      cnt = cnt + 1;
      ans = ans + 1;
      c[cnt] = b[i];
    } else {
      if (cnt >= 1) {
        cnt = cnt - 1;
      }
      ans = ans - 1;
    }
  }
  printf("%d\n", l - ans);
  return 0;
}
