#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int counter = 0;
  for (int i = 0; i < str.length() - 1; i++) {
    if ((str[i] == '0' and str[i + 1] == '1') or
        (str[i] == '1' and str[i + 1] == '0')) {
      str.erase(i, 2);
      i = 0;
      counter++;
    }
  }
  if (str.length() >= 2 and (str[0] == '0' and str[1] == '1') or
      (str[0] == '1' and str[1] == '0'))
    counter++;
  cout << counter << endl;
}
