#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, a, b, c, cc[500000];
char s[300000];
queue<char> q;
int main() {
  gets(s);
  for (int i = 0; i < strlen(s); i++) {
    cc[++k] = s[i] - '0';
    while (k >= 2 &&
           ((cc[k] == 0 && cc[k - 1] == 1) || (cc[k] == 1 && cc[k - 1] == 0)))
      k -= 2;
  }
  printf("%d\n", strlen(s) - k);
  return 0;
}
