#C7843. Longest Contiguous Color Sequence
Longest Contiguous Color Sequence
Longest Contiguous Color Sequence
You are given a sequence of colored tiles represented by a string. Your task is to determine the length of the longest contiguous subsequence of tiles that have the same color. In other words, for a given string (S), you need to find the maximum value of (k) such that there exists an index (i) where (S[i] = S[i+1] = \cdots = S[i+k-1]).
The input begins with an integer (T) representing the number of test cases. The next (T) lines each contain a string describing a sequence of colored tiles. For each test case, your program should output an integer on a new line, representing the length of the longest contiguous subsequence of the same color.
inputFormat
The first line of input contains an integer (T) denoting the number of test cases. This is followed by (T) lines, each containing a non-empty string representing a sequence of colored tiles. Each character in the string denotes a color.
outputFormat
For each test case, output a single integer on a new line denoting the length of the longest contiguous subsequence of tiles of the same color.## sample
3
aabbbcc
abcd
aaaaa
3
1
5
</p>