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