#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  string s;
  cin >> s;
  int len = s.size();
  s = '#' + s;
  int dp[200010][5];
  for (int i = 0; i < 200010; i++) {
    for (int j = 0; j < 5; j++) {
      dp[i][j] = 0;
    }
  }
  dp[1][1] = 0;
  for (int i = 1; i <= len; i++) {
    for (int j = 1; j <= 4; j++) {
      if (i - j < 0) continue;
      string bef = s.substr(i - j, j);
      for (int k = 1; k <= 4; k++) {
        if (i + k - 1 > len) continue;
        string aft = s.substr(i, k);
        if (bef != aft) {
          dp[i + k][k] = max(dp[i + k][k], dp[i][j] + 1);
        }
      }
    }
  }
  int ans = *max_element(dp[len + 1], dp[len + 1] + len + 1);
  cout << ans << endl;
}
