#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  int dp[200200][2];
  for (int i = 0; i < n + 1; i++) {
    for (int j = 0; j < 2; j++) {
      dp[i][j] = 1;
    }
  }
  dp[0][0] = 0;
  dp[0][1] = 0;
  for (int i = 0; i < n; i++) {
    dp[i + 1][0] = max(dp[i + 1][0], dp[i][1]);
    if (s[i - 1] != s[i]) dp[i + 1][0] = max(dp[i + 1][0], dp[i][0] + 1);
    if (i - 2 >= 0) dp[i + 1][1] = max(dp[i + 1][1], dp[i - 1][0] + 1);
    if (i - 3 >= 0 && (s[i] != s[i - 2] || s[i - 1] != s[i - 3]))
      dp[i + 1][1] = max(dp[i + 1][1], dp[i - 1][1] + 1);
  }
  cout << max(dp[n][0], dp[n][1]) << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
