#C1718. Longest Repeating Character Substring

    ID: 44954 Type: Default 1000ms 256MiB

Longest Repeating Character Substring

Longest Repeating Character Substring

Given a string, your task is to determine the length of the longest contiguous substring that consists of the same repeating character. For example, if the input string is aabbbcc, the longest substring with identical consecutive characters is bbb with a length of 3. Your program should read the input from standard input and output the result to standard output.

If the string is empty, the output should be 0.

The problem can be mathematically described as follows: Let \(s\) be a string of length \(n\). We need to find \(\max_{1 \leq i \leq n} L_i\) where \(L_i\) is the length of a contiguous segment of characters equal to \(s[i]\).

inputFormat

The input consists of a single line containing a string \(s\). The string may be empty and consists of characters.

outputFormat

Output a single integer representing the length of the longest substring of identical consecutive characters.

## sample
aabbbcc
3

</p>