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