#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.length();
  if (n == 1) {
    cout << n << endl;
    return 0;
  } else if (n == 2) {
    if (s[0] == s[1])
      cout << 1 << endl;
    else
      cout << 2 << endl;
    return 0;
  }
  vector<long long> dp1(n);
  vector<long long> dp2(n);
  dp1[0] = 0;
  if (s[0] == s[1])
    dp1[1] = -(1e16);
  else
    dp1[1] = 2;
  dp2[0] = -(1e16);
  dp2[1] = 1;
  for (int i = 2; i < n; i++) {
    if (s[i] != s[i - 1]) {
      dp1[i] = max(dp1[i - 1], dp2[i - 1]) + 1;
    } else {
      dp1[i] = dp2[i - 1] + 1;
    }
    if (i == 2) {
      dp2[i] = dp1[i - 2] + 1;
      continue;
    }
    if (s.substr(i - 3, 2) != s.substr(i - 1, 2)) {
      dp2[i] = max(dp1[i - 2], dp2[i - 2]) + 1;
    } else {
      dp2[i] = dp1[i - 2] + 1;
    }
  }
  cout << max(dp1[n - 1], dp2[n - 1]) << endl;
  return 0;
}
