#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long LLMAX = numeric_limits<long long>::max();
void No() { cout << "No" << endl; }
void Yes() { cout << "Yes" << endl; }
vector<long long> divisor(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret), greater<long long>());
  return (ret);
}
long long K[2][200001];
int main() {
  string S;
  cin >> S;
  long long N = S.size();
  K[0][0] = 0;
  K[1][0] = 0;
  K[0][1] = 0;
  K[1][1] = 1;
  for (long long i = 2; i < N; i++) {
    if (i >= 4 && S.substr(i - 1, 2) != S.substr(i - 3, 2)) {
      K[0][i] = max(K[0][i - 2] + 1, K[1][i - 2] + 1);
    } else {
      K[0][i] = K[1][i - 2] + 1;
    }
    if (S[i] != S[i - 1]) {
      K[1][i] = max(K[0][i - 1] + 1, K[1][i - 1] + 1);
    } else {
      K[1][i] = K[0][i - 1] + 1;
    }
  }
  cout << max(K[0][N - 1], K[1][N - 1]) << endl;
  return 0;
}
