#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int count = 1;
  int i2;
  for (int i = 1; i < n - 2; i++) {
    if (s[i] != s[i - 1]) {
      count++;
    } else {
      count++;
      i += 2;
      if (i < n - 2) {
        count++;
      } else if (i == n - 2) {
        count++;
        if (s[n - 2] != s[n - 1]) count++;
        cout << count << endl;
      } else {
        count++;
        cout << count << endl;
      }
    }
    i2 = i;
  }
  if (s[n - 3] != s[n - 2] && s[n - 2] != s[n - 1]) {
    count += 2;
  } else {
    count += 1;
  }
  cout << count << endl;
}
