#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  string s;
  cin >> s;
  long long n = s.size();
  long long res = 0;
  long long i = 0;
  long long before = 2;
  while (i < n) {
    if (before == 1 && s[i] == s[i + 1]) {
      res++;
      i += 2;
      before = 2;
    } else if (before == 1 && s[i] != s[i + 1]) {
      res++;
      i++;
    } else if (before == 2) {
      res++;
      i++;
      before = 1;
    }
  }
  cout << res - 1 << endl;
  return 0;
}
