#include <bits/stdc++.h>
using namespace std;
const int maxn = 200 * 1000 + 10;
int dp[maxn][2];
string s;
int main() {
  cin >> s;
  dp[0][0] = 1;
  dp[0][1] = -maxn;
  for (int i = 1; i < (((int)s.size())); i++) {
    dp[i][0] = dp[i - 1][1] + 1;
    if (s[i] != s[i - 1]) dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1);
    if (i == 1) continue;
    dp[i][1] = dp[i - 2][0] + 1;
    if (i >= 3 && (s[i - 3] != s[i - 1] || s[i - 2] != s[i]))
      dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1);
  }
  cout << max(dp[(((int)s.size())) - 1][0], dp[(((int)s.size())) - 1][1]);
  return 0;
}
