AmazonOA #159
Find Maximum Maxima Count
估计简单可在线判题
For each non-empty prefix of the original string, every character whose count reaches the maximum count in that prefix gets 1, including all tied characters. Find the maximum accumulated count of a single character.
输入格式
One line with a lowercase string, 1≤length≤100000.
输出格式
Output a single integer answer.
样例 1
输入:
bccaaacb
输出:
6
样例 2
输入:
zzzz
输出:
4
样例 3
输入:
ab
输出:
2
样例说明
Example 1: c is tied for or holds the maximum in prefixes 2, 3, 4, 5, 7 and 8, 6 times in total. Example 2: z is the maximum in all 4 prefixes, so the answer is 4. Example 3: a is the maximum in both a and ab, while b is the maximum only in ab, so the answer is 2.