#K70332. Maximum Consecutive Character Repetition
Maximum Consecutive Character Repetition
Maximum Consecutive Character Repetition
Given a string S consisting of lowercase English letters, your task is to find the maximum number of times any character appears consecutively in S. In other words, determine the largest block of repeated characters in the string.
For example, in the string aabbbccddaa
, the maximum consecutive repetition is 3 (character 'b' appears three times consecutively). If the string is empty, the output should be 0.
Note: Your solution must read input from stdin
and write output to stdout
.
inputFormat
The input consists of a single line containing the string S. The string contains only lowercase English letters and may be empty.
outputFormat
Output a single integer representing the maximum number of consecutive occurrences of any character in the string S.## sample
aabbbccddaa
3