#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const int maxn = 1e6 + 10;
int d[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
char a[maxn];
int main() {
  scanf("%s", a);
  int n = strlen(a);
  int ans = 0;
  int i;
  int bf = 1;
  for (i = 1; i < n; ++i) {
    if (a[i - 1] == a[i]) {
      if (bf == 2)
        ans++, bf = 1;
      else {
        bf = 2;
        ans++;
        i++;
      }
    } else
      ans++;
  }
  write(ans);
}
