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