#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  int k = 0;
  cin >> a;
  const char* x = a.c_str();
  vector<int> v;
  for (int i = 0; i < strlen(x); i++) {
    v.emplace_back(x[i] - '0');
  }
  int len = v.size();
  int c = len;
  while (k != len - 2 && len > 2) {
    if ((v[k]) + (v[k + 1]) == 1) {
      v.erase(v.begin() + k);
      v.erase(v.begin() + k + 1);
      k = -1;
    }
    len = v.size();
    k++;
  }
  cout << c - v.size() << endl;
}
