#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 28;
const double INF = 1e12, EPS = 1e-9;
void run() {
  string s;
  cin >> s;
  int ans = 0;
  while (!s.empty()) {
    int p = 0;
    for (; p < 5 && p < (int)s.size() && s[p] == s[0]; p++)
      ;
    ans++;
    s = s.substr(p);
  }
  cout << ans << endl;
}
int main() { run(); }
