#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  const int U = 4;
  int dp[n + 1][U + 1];
  for (int i = 0; i < n + 1; i++) {
    for (int j = 0; j < U + 1; j++) {
      dp[i][j] = -1;
    }
  }
  dp[0][0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < U + 1; j++) {
      if (dp[i][j] == -1) {
        continue;
      }
      for (int k = 1; i + k <= n && k <= U; k++) {
        if (k != j || s.substr(i - j, j) != s.substr(i, k)) {
          dp[i + k][k] = dp[i][j] + 1;
        }
      }
    }
  }
  int ans = 0;
  for (int j = 0; j < U + 1; j++) {
    ans = max(ans, dp[n][j]);
  }
  cout << ans << endl;
  return 0;
}
