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