SnowflakeOA #32
Maximum Substrings
估计中等可在线判题
Replace every dot with a letter from a..z to maximize the number of contiguous substrings whose characters are all the same. Substrings of length 1 also count, and fixed characters cannot be changed.
输入格式
One line containing the color string, of length 1..5000, where each character is a..z or a dot (.). Output the exact integer.
输出格式
Output the single integer required by the problem.
样例 1
输入:
a.b
输出:
4
样例 2
输入:
...
输出:
6
样例 3
输入:
aa..b
输出:
11
样例说明
The answers to the three public examples are, in order: 4; 6; 11. The examples were rechecked by independent enumeration, state search, or direct simulation.