#include <bits/stdc++.h>
using namespace std;
const int maxn = 210000;
char a[maxn];
int main() {
  scanf("%s", a + 1);
  int len = strlen(a + 1);
  int t = -1, ans = 0, t1 = 0;
  for (int i = 1; i <= len; i++) {
    int now = a[i] - 'a' + 1;
    if (now == t) {
      t = t * 100 + now;
      t1 = now;
    } else {
      ans++;
      if (t1 && (a[i - 2] != a[i - 3]))
        t = t1 * 100 + now;
      else
        t = now;
      t1 = 0;
    }
  }
  printf("%d\n", ans);
}
