#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0, dp[100010][2] = {};
  string s;
  cin >> s;
  n = s.length();
  ans = n;
  dp[0][0] = 1;
  dp[0][1] = -500000;
  dp[1][1] = 1;
  for (int i = 1; i < n; i++) {
    dp[i][0] = dp[i][1] = -500000;
    dp[1][1] = 1;
    if (s[i] != s[i - 1]) {
      dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1);
    }
    if (i >= 2) {
      dp[i][0] = max(dp[i][0], dp[i - 1][1] + 1);
      dp[i][1] = max(dp[i][1], dp[i - 2][0] + 1);
    }
    if (i >= 3 && (s[i] != s[i - 2] || s[i - 1] != s[i - 3])) {
      dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1);
    }
  }
  printf("%d\n", max(dp[n - 1][0], dp[n - 1][1]));
}
