#include <bits/stdc++.h>
using namespace std;
int dp[2][200000];
int main() {
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n; i++) {
    dp[0][i] = 0;
    dp[1][i] = 0;
  }
  dp[0][0] = 1;
  dp[1][1] = 1;
  dp[0][1] = s[0] != s[1];
  for (int i = 2; i < n; i++) {
    if (s[i] != s[i - 1]) dp[0][i] = dp[0][i - 1] + 1;
    dp[0][i] = max(dp[1][i - 1] + 1, dp[0][i]);
    if (i > 3 && s.substr(i - 1, 2) != s.substr(i - 3, 2))
      dp[1][i] = dp[1][i - 2] + 1;
    dp[1][i] = max(dp[0][i - 2] + 1, dp[1][i]);
  }
  cout << max(dp[0][n - 1], dp[1][n - 1]) << endl;
}
