#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int ans;
  int i, renzoku, len;
  cin >> s;
  len = s.length();
  ans = len;
  for (i = 0; i < len - 1; i++) {
    if (s[i] == s[i + 1]) {
      for (renzoku = 1; i + renzoku < len && renzoku <= 7; renzoku++) {
        if (s[i] != s[i + renzoku]) break;
      }
      int hiku;
      switch (renzoku) {
        case 2:
          hiku = 1;
          break;
        case 3:
          hiku = 1;
          break;
        case 4:
          hiku = 1;
          break;
        case 5:
          hiku = 2;
          break;
        case 6:
          hiku = 2;
          break;
        case 7:
          hiku = 2;
          break;
        case 8:
          hiku = 3;
          break;
      }
      ans = ans - hiku;
      if (i == 0 && renzoku == 2) ans += 1;
      i = i + renzoku - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
