#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> prime_factorize(int64_t x) {
  vector<pair<int64_t, int64_t>> p;
  for (int64_t i = 2; i * i <= x; i++) {
    int cnt = 0;
    if (x % i == 0) {
      while (x % i == 0) {
        cnt++;
        x /= i;
      }
      p.push_back(make_pair(i, cnt));
    }
  }
  if (x != 1) {
    p.push_back(make_pair(x, 1));
  }
  return p;
}
int main() {
  string s;
  cin >> s;
  vector<vector<int>> dp(200001, vector<int>(5));
  int N = s.size();
  s = 'x' + s;
  for (int i = 1; i < N; i++) {
    for (int j = 1; j < 5; j++) {
      for (int k = 1; k < 5; k++) {
        if (i - j < 0 || i + k >= N) {
          continue;
        }
        if (s.substr(i - j, j + 1) != s.substr(i, k + 1)) {
          chmax(dp[i + k][k], dp[i][j] + 1);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i < 5; i++) {
    ans = max(ans, dp[N - 1][i]);
  }
  cout << ans << endl;
  return 0;
}
