#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  string S;
  cin >> S;
  long long N = S.size();
  vector<bool> tower;
  for (long long i = 0; i < (long long)(N); i++) {
    if (S[i] == '0')
      tower.push_back(false);
    else
      tower.push_back(true);
  }
  vector<bool> t_old = tower;
  while (true) {
    vector<bool> t_new;
    long long i = 0;
    while (i < t_old.size()) {
      if (i == t_old.size() - 1) {
        t_new.push_back(t_old[i]);
        i++;
      } else if (t_old[i] != t_old[i + 1]) {
        i += 2;
      } else {
        t_new.push_back(t_old[i]);
        i++;
      }
    }
    if (t_new.size() == t_old.size()) {
      t_old = t_new;
      break;
    } else
      t_old = t_new;
  }
  cout << tower.size() - t_old.size() << endl;
}
