#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int maxN = 2 * (int)1e5 + 100;
string s;
const int BUBEN = 5;
int dp[maxN][BUBEN + 2];
int n;
const int INF = 5000000;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> s;
  n = s.size();
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < BUBEN; j++) {
      dp[i][j] = -INF;
    }
  }
  for (int i = 0; i < min(BUBEN, n); i++) {
    dp[i][i + 1] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < BUBEN; j++) {
      if (dp[i][j] < 0) continue;
      for (int take = i + 1; take <= min(i + BUBEN, n); take++) {
        if (s.substr(i - j + 1, j) != s.substr(i + 1, take - i)) {
          dp[take][take - i] = max(dp[take][take - i], dp[i][j] + 1);
        }
      }
    }
  }
  int best = -INF;
  for (int i = 0; i < BUBEN; i++) {
    best = max(best, dp[n - 1][i]);
  }
  cout << best;
  return 0;
}
