#include <bits/stdc++.h>
using namespace std;
string s;
int f[20100][3], n;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  n = s.length();
  for (int i = 0; i < n; i++)
    for (int k = 0; k < 3; k++) f[i][k] = -1;
  f[0][0] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++) {
      if (f[i][j] == -1) continue;
      for (int k = 1; k < 3; k++) {
        if (i + k > n) continue;
        if (j != k || s.substr(i - j, j) != s.substr(i, k))
          f[i + k][k] = max(f[i + k][k], f[i][j] + 1);
      }
    }
  int ans = 0;
  for (int i = 0; i < 3; i++) ans = max(ans, f[n][i]);
  cout << ans;
}
