#include <bits/stdc++.h>
using namespace std;
const int NMAX = 2 * 1e5 + 2;
string s;
int n, dp[2][NMAX];
int main() {
  ios::sync_with_stdio(false);
  cin >> s;
  n = s.size();
  dp[0][0] = 1;
  dp[1][0] = 0;
  dp[1][1] = 1;
  if (n == 0 || s[1] != s[0]) dp[0][1] = 1;
  for (int i = 2; i < n; i++) {
    if (s[i] != s[i - 1]) {
      dp[0][i] = max(dp[0][i], 1 + dp[0][i - 1]);
    }
    dp[0][i] = max(dp[0][i], 1 + dp[1][i - 1]);
    dp[1][i] = max(dp[1][i], 1 + dp[0][i - 2]);
    if (i >= 3 && (s[i] != s[i - 2] || s[i - 1] != s[i - 3]))
      dp[1][i] = max(dp[1][i], 1 + dp[1][i - 2]);
  }
  cout << max(dp[0][n - 1], dp[1][n - 1]) << '\n';
  return 0;
}
