#K54597. Longest Sequence of Identical Stamps
Longest Sequence of Identical Stamps
Longest Sequence of Identical Stamps
You are given several test cases. In each test case, you are given an integer \(N\) representing the number of stamps, followed by \(N\) integers that describe the stamps in the order they appear. Your task is to determine the length of the longest contiguous subsequence of identical stamps.
For example, consider the array [2, 2, 1, 1, 1, 3, 3, 3]
. The longest sequence of identical stamps is 3 (either the three consecutive 1's or the three consecutive 3's). If no stamps are provided (i.e. \(N = 0\)), the answer is 0.
Input Format: The first line of input contains an integer \(T\) denoting the number of test cases. Each test case consists of two lines. The first line contains an integer \(N\) representing the number of stamps. The second line contains \(N\) space-separated integers representing the stamps.
Output Format: For each test case, output a single line containing the length of the longest contiguous subsequence of identical stamps.
Note: All formulas are in \(\LaTeX\) format.
inputFormat
The input is read from standard input (stdin) with the following format:
- The first line contains an integer \(T\), the number of test cases.
- For each test case:
- The first line contains an integer \(N\), the number of stamps.
- The second line contains \(N\) space-separated integers.
outputFormat
For each test case, output the length of the longest contiguous subsequence of identical stamps on a new line. The output is written to standard output (stdout).
## sample1
8
2 2 1 1 1 3 3 3
3
</p>