#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int n = S.size();
  vector<int> v(n);
  v[0] = 1;
  v[1] = 1;
  v[2] = 1;
  for (int i = 1; i < n; i++) {
    if (S[i] != S[i - 1]) {
      v[i] = v[i - 1] + 1;
    } else {
      if (i >= 3) {
        v[i] = v[i - 3] + 2;
      }
    }
  }
  int ans = v[n - 1];
  cout << ans << endl;
}
