#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  int pre_n = 0;
  while (true) {
    int n = S.size();
    if (n <= 1 || n == pre_n) {
      cout << N - n << endl;
      return 0;
    }
    pre_n = n;
    for (int i = 0; i < n; i++) {
      if ((S[i] == '1' && S[i + 1] == '0') ||
          (S[i] == '0' && S[i + 1] == '1')) {
        S.erase(i, 2);
      }
    }
  }
  return 0;
}
