Given a sequence of integers, a plateau is a subsequence of consecutive identical numbers. For example, in 1 2 2 2 1 4 we have a plateau of length 3 formed by 2’s, and the rest of the plateaus have length 1. Your task is to write a program that checks for long enough plateaus.
First comes an integer ; then, starting in the next line, a sequence of integers follows, possibly spanning several lines in an unpredictable manner.
If there are or more consecutive occurrences of the same number, say , the answer should be "A plateau of ’s of length at least occurs.", with the right values of and inserted appropriately: must be such that the plateau of occurrences of is the first plateau of that length. Otherwise, the answer should be "No plateau of length occurs." Don’t forget the period at the end of these sentences.
Input
3 1 2 2 2 1 4
Output
A plateau of 2's of length at least 3 occurs.
Input
5 1 2 2 2 2 2 3
Output
A plateau of 2's of length at least 5 occurs.
Input
1 7 2 2
Output
A plateau of 7's of length at least 1 occurs.
Input
1 7
Output
A plateau of 7's of length at least 1 occurs.
Input
3 1 1 2 2 3 3 4 4
Output
No plateau of length 3 occurs.