#K33982. Longest Homogeneous Subarray
Longest Homogeneous Subarray
Longest Homogeneous Subarray
You are given an array of integers. Your task is to find the length of the longest contiguous subarray that consists of identical elements. A contiguous subarray is a sequence of consecutive elements in the array. For example, in the array [1, 1, 2, 2, 2, 3, 3, 3, 3, 4], the longest homogeneous subarray is [3, 3, 3, 3] with a length of 4.
If the array is empty, the answer is 0.
inputFormat
The input is given via standard input (stdin) and contains two lines:
- The first line contains an integer \(n\) \( (0 \le n \le 10^5)\) representing the number of elements in the array.
- The second line contains \(n\) space-separated integers representing the elements of the array. If \(n = 0\), the second line may be omitted.
outputFormat
Output a single integer to standard output (stdout), which is the length of the longest contiguous subarray of identical elements.
## sample10
1 1 2 2 2 3 3 3 3 4
4