#C4275. Longest Identical Sequence

    ID: 47795 Type: Default 1000ms 256MiB

Longest Identical Sequence

Longest Identical Sequence

The task is to determine the length of the longest uninterrupted sequence of identical characters in a given string.

Formally, given a string \( s \), you are required to compute:

\( \max_{\substack{1 \leq i \leq |s|}} (\text{length of continuous sequence at position } i) \)

For example, in the string "aaabbcccc", the longest sequence is "cccc" which has a length of 4.

You need to process multiple test cases. The input is given from standard input and the output should be printed to standard output.

inputFormat

The first line of input contains an integer T, representing the number of test cases. Each of the next T lines contains a string S. The string S may be empty.

outputFormat

For each test case, output a single integer on a separate line representing the length of the longest uninterrupted sequence of identical characters in the string.## sample

2
aaabbcccc
abbbbbbc
4

6

</p>