#include <bits/stdc++.h>
using namespace std;
char now;
string s;
int main() {
  int ans;
  cin >> s;
  ans = 1;
  int len = s.length();
  for (int i = 0; i < len - 1;) {
    int flag = 0;
    now = s[i + 1];
    if (s[i] == now) {
      if (i + 3 > len) flag = 1;
      i += 3;
      if (flag) ans++;
    } else
      now = s[i], i++, flag = 0;
    if (!flag) ans++;
  }
  cout << ans << endl;
  return 0;
}
