#include <bits/stdc++.h>
using namespace std;
int i, j, k;
char s[200010];
int ans = 0;
int flag = 0;
char last;
int main() {
  int n, m;
  scanf("%s", s);
  n = strlen(s);
  last = ' ';
  for (i = 0; i < n; ++i) {
    if (last != s[i]) {
      if (i + 2 == n - 1) {
        if (s[i + 1] == s[n - 1]) {
          ans += 2;
          break;
        } else {
          last = s[i];
          ++ans;
        }
      } else {
        last = s[i];
        ++ans;
      }
    } else if (s[i] == last) {
      if (s[i] == s[i + 2] && s[i + 1] == s[i + 3] && i + 3 == n - 1) {
        ans += 2;
        break;
      } else {
        i++;
        flag = 1;
        last = ' ';
        ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
