#include <bits/stdc++.h>
int main() {
  std::string S;
  std::cin >> S;
  using vi = std::vector<int>;
  using vvi = std::vector<vi>;
  vvi dp(S.size(), vi(2, -1));
  dp[0][0] = dp[0][1] = 1;
  for (int i{1}; i < (int)S.size(); i++) {
    if (i - 2 >= 0 && dp[i - 2][1] >= 0) dp[i][0] = dp[i - 2][1] + 1;
    if (i < (int)S.size() - 1 && dp[i - 1][0] >= 0) dp[i][1] = dp[i - 1][0] + 1;
    if (S[i - 1] != S[i] && dp[i - 1][0] >= 0)
      dp[i][0] = std::max(dp[i][0], dp[i - 1][0] + 1);
    if (i - 2 >= 0 && i + 1 < (int)S.size() &&
        (S[i - 2] != S[i] || S[i - 1] != S[i + 1]) && dp[i - 2][1] >= 0)
      dp[i][1] = std::max(dp[i][1], dp[i - 2][1] + 1);
  }
  int ans{dp.back()[0]};
  if (dp.size() >= 2) ans = std::max(ans, dp[dp.size() - 1][1]);
  printf("%d\n", ans);
  return 0;
}
