#include <bits/stdc++.h>
using namespace std;
using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int, int>;
using VP = vector<PII>;
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  VVI dp(n, VI(3));
  dp[0][1] = dp[0][2] = 1;
  for (int i = int(1); i < int(n); i++) {
    if (s[i] != s[i - 1]) dp[i][1] = dp[i - 1][1] + 1;
    if (i < n - 1) dp[i][2] = dp[i - 1][1] + 1;
    if (i > 1) {
      dp[i][1] = max(dp[i][1], dp[i - 2][2] + 1);
      if (i < n - 1 && s.substr(i - 2, 2) != s.substr(i, 2)) {
        dp[i][2] = max(dp[i][2], dp[i - 2][2] + 1);
      }
    }
  }
  cout << dp[n - 1][1] << endl;
}
int main() {
  solve();
  return 0;
}
