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 n ≥ 1; then, starting in the next line, a
sequence of integers follows, possibly spanning several lines in an
unpredictable manner.

Output

If there are n or more consecutive occurrences of the same number, say
i, the answer should be "A plateau of i’s of length at least n occurs.",
with the right values of i and n inserted appropriately: i must be such
that the plateau of n occurrences of i is the first plateau of that
length. Otherwise, the answer should be "No plateau of length n 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
