#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string::size_type p;
  int cnt = 0;
  while (true) {
    p = s.find("01");
    p = (p != string::npos ? p : s.find("10"));
    if (p != string::npos) {
      cnt++;
      s.replace(p, 2, "");
    } else {
      cout << cnt;
      break;
    }
  }
}
