#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size(), k = 1, in = 0, in1 = 0;
  for (int i = 1; i < n;) {
    if (s[i] == s[i - 1] && in == i - 1 && i != n - 1) {
      k++;
      in1 = in;
      in = i;
      i += 2;
    } else {
      if (i != n - 1 || (i == n - 1 && s[i] != s[i - 1]))
        k++;
      else {
        if (i - 4 == in1) {
          if (s[i] == s[i - 2] && s[i - 1] == s[i - 3]) k--;
        }
      }
      in1 = in;
      in = i;
      i++;
    }
  }
  cout << k << endl;
  return 0;
}
