Gemstones
题号:NC51630
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Gromah and LZR have entered the seventh level. There are a sequence of gemstones on the wall.

After some tries, Gromah discovers that one can take exactly three successive gemstones with the same types away from the gemstone sequence each time, after taking away three gemstones, the left two parts of origin sequence will be merged to one sequence in origin order automatically.

For example, as for "ATCCCTTG", we can take three 'C's away with two parts "AT", "TTG" left, then the two parts will be merged to "ATTTG", and we can take three 'T's next time.

The password of this level is the maximum possible times to take gemstones from origin sequence.

Please help them to determine the maximum times.

输入描述:

Only one line containing a string , denoting the gemstone sequence, where the same letters are regarded as the same types.



only contains uppercase letters.

输出描述:

Print a non-negative integer in a single line, denoting the maximum times.
示例1

输入

复制
ATCCCTTG

输出

复制
2

说明

One possible way is that ``ATCCCTTG\,.