#include <bits/stdc++.h>
using namespace std;
int main() {
  string input;
  cin >> input;
  int n = input.length();
  char temp = input[0];
  int ans = 2;
  int count = 0;
  for (int i = 1; i < n; i++) {
    if (input[i] != temp) {
      ++ans;
      temp = input[i];
      count = 0;
    } else {
      ++count;
      if (count == 2) {
        ++ans;
        count = 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
