#include <bits/stdc++.h>
char c[1000];
int main() {
  int i, x, t = 0;
  scanf("%s", c);
  for (i = 0; c[i]; i++) {
    for (x = 0; c[i + x] == c[i] && x < 5; x++)
      ;
    t++;
    i = i + x - 1;
  }
  printf("%d\n", t);
  return 0;
}
