#include <bits/stdc++.h>
using namespace std;
char a[200002], la[200002];
int ans;
int main() {
  scanf("%s", a + 1);
  int n = strlen(a + 1), t = 2;
  for (int i = 1; i <= n;) {
    if (t == 2) {
      t = 1;
      la[1] = a[i];
      ans++;
      i++;
    } else if (a[i] == a[i + 1]) {
      t = 2;
      la[1] = a[i], la[2] = a[i];
      ans++;
      i += 2;
    } else {
      t = 1;
      la[1] = a[i];
      ans++;
      i++;
    }
  }
  printf("%d", ans - 1);
}
