Long Enough Plateaus

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.

Input

First comes an integer n1n\geq 1; then, starting in the next line, a sequence of integers follows, possibly spanning several lines in an unpredictable manner.

Output

If there are nn or more consecutive occurrences of the same number, say ii, the answer should be "A plateau of ii’s of length at least nn occurs.", with the right values of ii and nn inserted appropriately: ii must be such that the plateau of nn occurrences of ii is the first plateau of that length. Otherwise, the answer should be "No plateau of length nn occurs." Don’t forget the period at the end of these sentences.

Problem information

Author: José Luis Balcázar

Generation: 2026-01-25T19:36:26.514Z

© Jutge.org, 2006–2026.
https://jutge.org