Codeforces Beta Round 98 (Div. 2)
A
Postcards and photos
Codeforces
900
原题
←B →
翻译中…

Polycarpus has postcards and photos hung in a row on the wall. He decided to put them away to the closet and hang on the wall a famous painter's picture. Polycarpus does it like that: he goes from the left to the right and removes the objects consecutively. As Polycarpus doesn't want any mix-ups to happen, he will not carry in his hands objects of two different types. In other words, Polycarpus can't carry both postcards and photos simultaneously. Sometimes he goes to the closet and puts the objects there, thus leaving his hands free. Polycarpus must put all the postcards and photos to the closet. He cannot skip objects. What minimum number of times he should visit the closet if he cannot carry more than 5 items?

翻译中…

Input

翻译中…

The only line of the input data contains a non-empty string consisting of letters "С" and "P" whose length does not exceed $100$ characters. If the $*i*$-th character in the string is the letter "С", that means that the $*i*$-th object (the numbering goes from the left to the right) on Polycarpus' wall is a postcard. And if the $*i*$-th character is the letter "P", than the $*i*$-th object on the wall is a photo.

翻译中…

Output

翻译中…

Print the only number — the minimum number of times Polycarpus has to visit the closet.

翻译中…

Note

翻译中…

In the first sample Polycarpus needs to take one item to the closet 7 times.

翻译中…

In the second sample Polycarpus can first take 3 postcards to the closet; then 3 more. He can take the 6 photos that are left in the similar way, going to the closet twice.

翻译中…

In the third sample Polycarpus can visit the closet twice, both times carrying 3 postcards. Then he can take there 2 photos at once, then one postcard and finally, he can carry the last 10 photos if he visits the closet twice.

翻译中…

In the fourth sample Polycarpus can visit the closet twice and take there all 10 postcards (5 items during each go).

翻译中…

样例

Input #1
CPCPCPC
Output #1
7
InputCopy OutputCopy
Input #2
CCCCCCPPPPPP
Output #2
4
InputCopy OutputCopy
Input #3
CCCCCCPPCPPPPPPPPPP
Output #3
6
InputCopy OutputCopy
Input #4
CCCCCCCCCC
Output #4
2
InputCopy OutputCopy
题目信息
题号
137A
时间限制
2 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。