#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1100000000;
constexpr long long LLINF = 1100000000000000000;
long long dp[210000][2];
int main() {
  string s;
  cin >> s;
  for (long long i = 0; i < 210000; i++) dp[i][0] = dp[i][1] = -1;
  dp[0][0] = 1;
  dp[0][1] = -1;
  for (long long i = 0; i < s.size(); i++) {
    if (dp[i][0] >= 0) {
      char c = s[i];
      if (i + 1 < s.size() && s[i + 1] != c) {
        dp[i + 1][0] = max(dp[i + 1][0], dp[i][0] + 1);
      }
      if (i + 2 < s.size()) {
        dp[i + 2][1] = max(dp[i + 2][1], dp[i][0] + 1);
      }
    }
    if (i > 0 && dp[i][1] >= 0) {
      if (i + 1 < s.size()) {
        dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + 1);
      }
      if (i + 2 < s.size() && s[i - 1] != s[i + 1] && s[i] != s[i + 2]) {
        dp[i + 2][1] = max(dp[i + 2][1], dp[i][1] + 1);
      }
    }
  }
  cout << max(dp[s.size() - 1][0], dp[s.size() - 1][1]) << endl;
  return 0;
}
