#include <bits/stdc++.h>
using namespace std;
const int INF = 100100100;
const long long LINF = 1e18 + 100;
const int MOD = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ;
  string S;
  cin >> S;
  int N = S.size();
  vector<int> g(N);
  g[0] = 1;
  for (int i = (1); i < (N); i++) {
    if (S[i] != S[i - 1]) {
      g[i] = g[i - 1] + 1;
    } else {
      if (i >= 3) {
        g[i] = g[i - 3] + 2;
      } else {
        g[i] = 1;
      }
    }
  }
  cout << g[N - 1] << endl;
}
