#include <bits/stdc++.h>
using namespace std;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
long long dp[201000][3];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  long long ans = 0;
  for (long long i = (long long)0; i < (long long)s.size(); i++) {
    for (long long j = (long long)1; j < (long long)3; j++) {
      if (i - j == -1) dp[i][j] = 1;
      if (i - 2 * j < 0) continue;
      dp[i][j] = max(dp[i][j], dp[i - j][j % 2 + 1] + 1);
      if (s.substr(i - 2 * j, j) != s.substr(i - j, j))
        dp[i][j] = max(dp[i][j], dp[i - j][j] + 1);
      ans = max(ans, dp[i][j]);
    }
  }
  cout << ans << endl;
}
