#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1e16;
int main() {
  string s;
  cin >> s;
  long long n = s.size();
  vector<vector<long long>> dp(n + 1, vector<long long>(3));
  dp[1][1] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= 2; j++) {
      for (long long k = 1; k <= 2; k++) {
        bool ok = true;
        if (j == k) {
          if (j == 1) {
            if (s[i - 1] == s[i]) {
              ok = false;
            }
          } else if (j == 2) {
            if (2 <= i && i < n - 1 && s[i - 2] == s[i] &&
                s[i - 1] == s[i + 1]) {
              ok = false;
            }
          }
        }
        if (ok) {
          dp[i + k][k] = max(dp[i + k][k], dp[i][j] + 1);
        }
      }
    }
  }
  cout << max(dp[n][1], dp[n][2]) << endl;
  return 0;
}
