#K79057. Longest Consecutive Subsequence

    ID: 35223 Type: Default 1000ms 256MiB

Longest Consecutive Subsequence

Longest Consecutive Subsequence

You are given a string (s) and are required to determine the length of the longest contiguous subsequence in which all characters are identical. In other words, you need to find the maximum number of consecutive occurrences of the same character in the string. If the string is empty, output 0.

For example, given the string "aaabbbaaacccdde", the longest contiguous sequence of identical characters is of length 3 (e.g. "aaa").

inputFormat

The input begins with an integer (T) representing the number of test cases. Each of the following (T) lines contains a non-empty string (s).

Example: Input: 3 aaabbbaaacccdde abcdeeee abbccdddeeeeeeeee

outputFormat

For each test case, output a single integer on a new line denoting the length of the longest contiguous subsequence of identical characters for the given string.## sample

3
aaabbbaaacccdde
abcdeeee
abbccdddeeeeeeeee
3

4 9

</p>