#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long int cnt = 1;
  char cur = s[0];
  int i = 1;
  while (1) {
    if (s[i] != cur) {
      cur = s[i];
      cnt++;
      i++;
      if (i == s.length()) {
        break;
      }
    } else {
      if (i == s.length() - 1) {
        break;
      } else if (i == s.length() - 2) {
        cnt++;
        break;
      } else {
        cur = s[i + 2];
        i += 3;
        cnt += 2;
      }
    }
  }
  cout << cnt << endl;
}
