#include <bits/stdc++.h>
using namespace std;
int dp[200005][2];
char ss[505];
int main() {
  cin >> ss + 1;
  int Len = strlen(ss + 1);
  dp[0][0] = 0;
  dp[1][0] = 1;
  for (int i = 2; i <= Len; i++) {
    dp[i][0] = max(dp[i - 1][1] + 1, dp[i][0]);
    if (ss[i] != ss[i - 1]) dp[i][0] = max(dp[i - 1][0] + 1, dp[i][0]);
    dp[i][1] = max(dp[i - 2][0] + 1, dp[i][1]);
    if (ss[i] != ss[i - 2] && ss[i - 1] != ss[i - 3])
      dp[i][1] = max(dp[i - 2][1] + 1, dp[i][1]);
  }
  cout << max(dp[Len][0], dp[Len][1]);
  return 0;
}
