#include <bits/stdc++.h>
using namespace std;
using ll = long long;
string f(string x) {
  string s = "";
  if (x.size() <= 1) return x;
  if (x.size() == 2 && x[0] == x[1]) return x;
  for (int i = 0; i < x.size(); i++) {
    if (x[i] == '0' && x[i + 1] == '1' || x[i] == '1' && x[i + 1] == '0') {
      if (i > 0) s += x.substr(0, i);
      if (i < x.size() - 1) s += x.substr(i + 2, x.size() - i + 1);
      break;
    }
  }
  if (s.size() > 0 && s.size() != x.size()) return f(s);
  return s;
}
int main() {
  string s;
  cin >> s;
  string t = f(s);
  cout << s.size() - t.size() << endl;
}
