#include <bits/stdc++.h>
using namespace std;
string s;
int ans, st;
int main() {
  cin >> s;
  ans = 1;
  st = 1;
  for (int i = 1; i < s.size(); ++i)
    if (s[i] == s[i - 1] && st < 5)
      ++st;
    else {
      st = 1;
      ans++;
    }
  cout << ans << endl;
}
