#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const long long LINF = (long long)INF * INF;
const int MAX = 1 << 17;
const int K = 4;
int dp[MAX][K];
void upd(int& x, int val) { x = max(x, val); }
int main() {
  string s;
  cin >> s;
  int n = (int)((s).size());
  for (int i = (0); i < (MAX); ++i)
    for (int j = (0); j < (K); ++j) dp[i][j] = -INF;
  for (int i = (0); i < (K); ++i) dp[i][i] = 1;
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (K); ++j) {
      if (dp[i][j] >= 0 && i + j + 1 < n) {
        bool ok = false;
        for (int k = (i - j); k < (i + 1); ++k) ok |= s[k] != s[k + j + 1];
        if (ok) upd(dp[i + j + 1][j], dp[i][j] + 1);
      }
      for (int k = (0); k < (K); ++k)
        if (k != j && i + k + 1 < n) upd(dp[i + k + 1][k], dp[i][j] + 1);
    }
  int ans = 0;
  for (int i = (0); i < (K); ++i) upd(ans, dp[n - 1][i]);
  cout << ans;
  return 0;
}
