1 /* 2 水! 3 */ 4 #include <cstdio> 5 #include <cstring> 6 #include <algorithm> 7 using namespace std; 8 9 const int MAXN = 1e2 + 10; 10 const int INF = 0x3f3f3f3f; 11 char s[MAXN]; 12 13 int main(void) //CodeForces 137A Postcards and photos 14 { 15 // freopen ("E.in", "r", stdin); 16 17 while (scanf ("%s", s) == 1) 18 { 19 int len = strlen (s); 20 int ans = 0; int i = 0; 21 while (i < len) 22 { 23 char ch = s[i]; int cnt = 1; 24 while (cnt < 5 && i < len) 25 { 26 if (s[i+1] == ch) 27 { 28 ++cnt; ++i; 29 } 30 else break; 31 } 32 ans++; i++; 33 } 34 35 printf ("%d\n", ans); 36 } 37 38 return 0; 39 }