#include <bits/stdc++.h>
using namespace std;
template <typename TYPE>
inline void chkmax(TYPE &x, TYPE y) {
  x < y ? x = y : 0;
}
template <typename TYPE>
inline void chkmin(TYPE &x, TYPE y) {
  y < x ? x = y : 0;
}
template <typename TYPE>
void readint(TYPE &x) {
  x = 0;
  int f = 1;
  char c;
  for (c = getchar(); !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  x *= f;
}
const int MAXN = 200005;
int n, f1[MAXN], f2[MAXN];
char s[MAXN];
int main() {
  int ans = 0, cur = 0;
  scanf("%s", s + 1);
  n = strlen(s + 1);
  f1[1] = f2[2] = 1;
  if (s[1] != s[2]) f1[2] = 2;
  f2[1] = -(1 << 30);
  for (int i = (3); i <= (n); ++i) {
    f2[i] = f1[i - 2] + 1;
    if (s[i] != s[i - 2] || s[i - 1] != s[i - 3]) chkmax(f2[i], f2[i - 2] + 1);
    f1[i] = f2[i - 1] + 1;
    if (s[i] != s[i - 1]) chkmax(f1[i], f1[i - 1] + 1);
  }
  printf("%d\n", max(f1[n], f2[n]));
  return 0;
}
