#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int cnt1 = 0, cnt2 = 0;
  cin >> s;
  int n = (int)s.length();
  for (int i = 0; i < n; i++) {
    if (s[i] == s[i + 1]) {
      cnt1++;
      i += (i + 1);
    } else {
      cnt2++;
      i += (i + 1);
    }
  }
  cout << n - max(cnt2, cnt1) << endl;
  return 0;
}
