#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int dp[200001][5];
int main() {
  string S;
  cin >> S;
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 0; i < S.size(); i++) {
    for (int j = 0; j <= min(i, 4); j++) {
      if (dp[i][j] == -1) continue;
      for (int k = 1; k <= 4; k++) {
        if (i + k > S.size()) break;
        if (S.substr(i - j, j) != S.substr(i, k)) {
          dp[i + k][k] = max(dp[i + k][k], dp[i][j] + 1);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= 4; i++) ans = max(ans, dp[S.size()][i]);
  cout << ans << endl;
}
