#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
char s[N];
int ans, cnt;
int main() {
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  cnt = 1;
  ++ans;
  for (int i = 2; i <= len; ++i) {
    if (s[i] != s[i - 1] && cnt == 1)
      cnt = 1, ++ans;
    else if (s[i] != s[i - 2] && cnt == 2)
      ++ans, cnt = 1;
    else if (s[i] == s[i - 1] && cnt == 1)
      cnt = 2, ++ans, i++;
    else if (s[i] == s[i - 2] && cnt == 2)
      ++ans;
  }
  printf("%d", ans);
  return 0;
}
