#include <bits/stdc++.h>
using namespace std;
string S;
int state[200002][26][27];
int main(void) {
  cin >> S;
  memset(state, -1, sizeof(state));
  state[0][S[0] - 'a'][26] = 1;
  if (S.size() > 1) {
    state[1][S[0] - 'a'][S[1] - 'a'] = 1;
  }
  for (int i = 0; i < S.size() - 1; i++) {
    for (int j = 0; j < 26; j++) {
      for (int k = 0; k < 27; k++) {
        if (state[i][j][k] == -1) continue;
        if (k == 26) {
          if (S.size() > i + 1 && S[i + 1] - 'a' != j) {
            state[i + 1][S[i + 1] - 'a'][26] =
                max(state[i + 1][S[i + 1] - 'a'][26], state[i][j][k] + 1);
          }
          if (S.size() > i + 2) {
            state[i + 2][S[i + 1]][S[i + 2]] =
                max(state[i + 2][S[i + 1]][S[i + 2]], state[i][j][k] + 1);
          }
        } else {
          if (S.size() > i + 1) {
            state[i + 1][S[i + 1] - 'a'][26] =
                max(state[i + 1][S[i + 1] - 'a'][26], state[i][j][k] + 1);
          }
          if (S.size() > i + 2 &&
              (S[i + 2] - 'a' != j || S[i + 1] - 'a' != k)) {
            state[i + 2][S[i + 1]][S[i + 2]] =
                max(state[i + 2][S[i + 1]][S[i + 2]], state[i][j][k] + 1);
          }
        }
      }
    }
  }
  int ans = 1;
  for (int j = 0; j < 26; j++) {
    for (int k = 0; k < 27; k++) {
      ans = max(ans, state[S.size() - 1][j][k]);
    }
  }
  cout << ans << endl;
}
