In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of October 18th
(this exercise will still be available for submission after that deadline, but without couting towards your grade)
[to understand the context of this problem, you should read the class #02 exercise sheet]
One of these things is not like the others... but is it so? How many numbers are actually like the others?
Write a program that determines the maximum length of consecutive identical numbers in a sequence of n positive integers.
The first line of input contains an integer n, the size of the sequence to consider.
The following n lines describe the sequence. The (i+1)-the line contains si, the (i)-th element of the sequence s1, s2, ..., sn
The output should be a single line containing one integers: the length of the longest stretch of the same number, as described in the problem section.
The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ n ≤ 100 | Size of the sequence | |
1 ≤ si ≤ 100 | Integers in the sequence |
Example Input 1 | Example Output 1 |
8 3 3 2 2 2 5 5 2 |
3 |
Explanation of the example input 1: the largest stretch of identical numbers is 3 and is indicated in red:
3 3 2 2 2 5 5 2
Example Input 2 | Example Output 2 |
5 42 30 15 2 88 |
1 |
Explanation of the example input 2: the largest stretch of identical numbers is 1 because all numbers are different.