#include <bits/stdc++.h>
using namespace std;
template <typename Tn>
Tn __lcm(Tn a, Tn b) {
  return a / __gcd(a, b) * b;
}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
  string s;
  cin >> s;
  long long int ans = s.size();
  bool flg = false;
  int cnt = 1;
  for (int i = 0; i < s.size() - 2; i++) {
    if (s[i] == s[i + 1] && s[i + 1] == s[i + 2]) {
      ans--;
      i++;
      flg = false;
    } else if (s[i] == s[i + 1]) {
      if (!flg) {
        ans--;
        flg = true;
        i++;
      } else {
        flg = false;
      }
    } else {
      flg = false;
    }
  }
  if (s[s.size() - 1] == s[s.size() - 2]) ans--;
  cout << ans << endl;
  return 0;
}
