#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int pos = S.find("01");
  if (pos == string::npos) pos = S.find("10");
  int res = (int)S.length();
  while (pos != string::npos) {
    S.erase(pos, pos + 1);
    pos = S.find("01");
    if (pos == string::npos) pos = S.find("10");
  }
  if (res % 2 == 0 && (int)S.length() == 1) res++;
  res -= (int)S.length();
  cout << res << endl;
  return 0;
}
