| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 3 | 0 | 0 | 0.000% |
At the beginning of 16-th century a group of European explorers arrived to the island inhabited by several tribes that never seen a person from Europe.
In order to establish friendship with island inhabitants, a group leader is going to give a present to the head of any local tribe explorers meet on their way. In order to do so, group leader brought a long chain of glass pieces that looks similar to jewels. Consider this chain to be a string $s$ consisting of lowercase English letters, with each letter denoting the type of glass piece on the corresponding position. Explorers are going to cut down the chain into small fragments and give exactly one fragment to head of each tribe they meet. The group leader is going to divide the chain into fragments according to the following rules:
Help group leader to find out the maximum possible fragment count that may be obtained without violating the rules above.
In the only line of input there is a non-empty string $s$ consisting of lowercase English letters. The length of string $s$ does not exceed $5 \cdot 10^6$ characters.
Print the only number, the maximum possible number of fragments the explorers may cut the given chain without violating any of the rules of the group leader.
abbabbbab
3
aabb
1
In the first sample test explorers may split a chain abbabbbab into fragments abb, abb, bab, in this case they will give each tribe head a fragment consisting of one glass piece of type a and two glass pieces of type b.
In the second sample case it is impossible to divide a chain into more than one fragment.