#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  string input;
  cin >> input;
  i = 0;
  int res = 0;
  while (i < (int)(input).size()) {
    char c = input[i];
    int cnt = 1;
    while (i < (int)(input).size() and cnt <= 5 and input[i] == c) {
      cnt++;
      i++;
    };
    res++;
  }
  cout << res << "\n";
  return 0;
}
