#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
long long dp[20010][2] = {0};
signed main() {
  string s;
  cin >> s;
  long long n = s.size();
  dp[1][0] = 1;
  dp[1][1] = 0;
  for (long long i = 2; i <= n; i++) {
    if (i < 4 || (s[i - 1] == s[i - 3] && s[i - 2] == s[i - 4])) {
      dp[i][1] = dp[i - 2][0] + 1;
    } else {
      dp[i][1] = max(dp[i - 2][0], dp[i - 2][1]) + 1;
    }
    if (s[i - 1] == s[i - 2]) {
      dp[i][0] = dp[i - 1][1] + 1;
    } else {
      dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]) + 1;
    }
  }
  cout << max(dp[n][0], dp[n][1]) << endl;
  return 0;
}
