#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  string s;
  cin >> s;
  int before = s.size();
  int flag = 1;
  while (flag) {
    int tmp = s.size();
    for (int i = 0; i < (int)(s.size() - 1); i++) {
      if (s.substr(i, 2) == "01") {
        s.erase(i, 2);
      } else if (s.substr(i, 2) == "10") {
        s.erase(i, 2);
      }
    }
    if (s.size() == tmp) {
      flag = 0;
    }
  }
  cout << before - s.size() << endl;
}
