#C11692. Longest Contiguous Subarray with Same Value
Longest Contiguous Subarray with Same Value
Longest Contiguous Subarray with Same Value
Given an array of integers, your task is to find the length of the longest contiguous subarray where all the elements have the same value.
For example, if the array is [2, 2, 2, 1, 2, 2, 5, 5, 5, 5], the longest contiguous subarray with the same value is [5, 5, 5, 5], so the answer is 4.
If the array is empty, the answer should be 0.
Note: The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
The first line of input contains an integer n, which represents the number of elements in the array. If n is 0, the array is empty. The second line contains n space-separated integers representing the elements of the array.
outputFormat
Print a single integer which is the length of the longest contiguous subarray that contains the same value.
## sample10
2 2 2 1 2 2 5 5 5 5
4