#P6181. Widest Mountain
Widest Mountain
Widest Mountain
Bessie measured the heights at (N) positions, denoted as (h_i) (where (1 \leq N \leq 10^5) and (1 \leq h_i \leq 10^9)). A mountain is defined as a contiguous subsequence in which the heights first do not decrease and then do not increase. Note that for mountains at the edges of Bessie's view, the sequence may only be non-decreasing or non-increasing. The width of a mountain is the number of positions it contains.
Your task is to find the maximum width among all mountains in the sequence.
inputFormat
The first line contains an integer (N). The second line contains (N) space-separated integers representing the heights (h_1, h_2, \ldots, h_N).
outputFormat
Output a single integer, the maximum width of a mountain.
sample
7
1 2 2 3 2 2 1
7
</p>