#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 7;
const int K = 5;
int n;
int a[N];
int dp[N][K];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  string s;
  cin >> s;
  n = (int)s.size();
  for (int i = 1; i <= n; i++) {
    a[i] = s[i - 1] - '0';
  }
  for (int i = 1; i <= n; i++) {
    for (int a = 1; a < K; a++) {
      for (int b = 1; b < K && a + b <= i; b++) {
        string sa;
        string sb;
        for (int j = i - a + 1; j <= i; j++) {
          sa += s[j];
        }
        for (int j = i - a - b + 1; j <= i - a; j++) {
          sb += s[j];
        }
        if (sa != sb) {
          dp[i][a] = max(dp[i][a], dp[i - a][b] + 1);
        }
      }
    }
  }
  int res = 0;
  for (int j = 0; j < K; j++) {
    res = max(res, dp[n][j]);
  }
  cout << res << "\n";
  return 0;
}
