#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const int INF = 1000000007;
string S;
int trgt, cnt;
int check_count(string s) {
  char pre[2] = "";
  while (trgt < S.size()) {
    char now[2] = "";
    now[0] = S[trgt];
    if (strcmp(now, pre) != 0) {
      pre[0] = now[0];
      pre[1] = now[1];
      cnt++;
      trgt++;
      continue;
    }
    if (trgt == S.size() - 1) {
      cnt--;
      break;
    }
    trgt++;
    now[1] = S[trgt];
    if (strcmp(now, pre) != 0) {
      pre[0] = now[0];
      pre[1] = now[1];
      cnt++;
      trgt++;
    }
  }
  return cnt;
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> S;
  trgt = 0;
  cnt = 0;
  int ans1 = check_count(S);
  string T = S.substr(2, S.size() - 2);
  cnt = 1;
  trgt = 2;
  int ans2 = check_count(T);
  cout << max(ans1, ans2) << endl;
  return 0;
}
