#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int INF = 1e9;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  vector<array<int, 2>> t(n);
  t[0][0] = 1;
  t[0][1] = -INF;
  t[1][0] = s[0] == s[1] ? 1 : -INF;
  t[1][1] = 1;
  for (int i = 2; i < n; ++i) {
    t[i][0] = t[i - 1][1] + 1;
    t[i][1] = t[i - 2][0] + 1;
    if (s[i - 1] != s[i]) t[i][0] = max(t[i][0], t[i - 1][0] + 1);
    if (i > 2 && s.substr(i - 3, 2) != s.substr(i - 1, 2))
      t[i][1] = max(t[i][1], t[i - 2][1] + 1);
  }
  cout << max(t[n - 1][0], t[n - 1][1]) << endl;
  return 0;
}
