#include <bits/stdc++.h>
using namespace std;
long long n;
string s;
set<string> st;
long long dp[100005][2] = {0};
long long solve();
int main() {
  cin >> s;
  cout << solve() << endl;
  return 0;
}
long long solve() {
  n = s.size();
  dp[1][0] = 1;
  dp[2][1] = 1;
  for (int i = 1; i < n; ++i) {
    if (s[i] != s[i - 1])
      dp[i + 1][0] = max(dp[i][0], dp[i][1]) + 1;
    else
      dp[i + 1][0] = dp[i][1] + 1;
    if (i < 3) continue;
    string x, y;
    x = s[i - 3] + s[i - 2];
    y = s[i - 1] + s[i];
    dp[i + 1][1] = dp[i - 1][0] + 1;
    if (x != y) dp[i + 1][1] = max(dp[i + 1][1], dp[i - 2][1] + 1);
  }
  return max(dp[n][0], dp[n][1]);
}
