#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
int main() {
  string s;
  cin >> s;
  long long ans = 1;
  string prev;
  long long x = s.size();
  if (x == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (s[0] == s[1]) {
    prev.push_back(s[0]);
    prev.push_back(s[1]);
  } else
    prev = s[0];
  long long i = prev.size();
  while (i < x) {
    if (prev.size() == 2 and i == x - 2 and prev[0] == s[i] and
        prev[1] == s[i + 1]) {
      i += 2;
      ans++;
    } else if (prev.size() == 2) {
      prev = s[i];
      i++;
      ans++;
    } else {
      if (s[i] == prev[0]) {
        prev.clear();
        prev.push_back(s[i]);
        prev.push_back(s[i + 1]);
        i += 2;
        ans++;
      } else {
        prev = s[i];
        i++;
        ans++;
      }
    }
  }
  cout << ans << endl;
}
