#include <bits/stdc++.h>
using namespace std;
int dp[100009][7];
string s;
bool F(int a, int b, int x, int y) {
  for (int i = a; i <= b; i++)
    if (s[i] != s[x - a + i]) return 0;
  return 1;
}
int main() {
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    if (i <= 2) dp[i][i + 1] = 1;
    for (int j = 1; j <= 3; j++) {
      for (int k = 1; k <= 3; k++) {
        if (j + k <= i + 1) {
          if (j == k && F(i - j - k + 1, i - j, i - j + 1, i)) continue;
          dp[i][j] = max(dp[i][j], dp[i - j][k] + 1);
        }
      }
    }
  }
  cout << max(dp[n - 1][1], max(dp[n - 1][2], dp[n - 1][3])) << endl;
}
