You have gone to visit a plantation of Christmas trees before the holidays! The plantation you have visited is quite unique, as it consists of one row of
You are interested in finding patterns within the trees. Therefore, your job is to create a program that will output the length of the longest contiguous group of trees strictly increasing in height and the length of the longest contiguous group of trees strictly decreasing in height. The same tree(s) can be included in the two different contiguous groups.
Constraints
Input Specification
The first line consists of a single integer,
The second line contains
Output Specification
The output should consist of two lines: the first line should contain a single integer, giving the length of the longest contiguous group of trees that are strictly increasing in height, and the second line should also contain a single integer, giving the length of the longest contiguous group of trees that are strictly decreasing in height.
Sample Input 1
4
1 3 4 2
Sample Output 1
3
2
Explanation of Sample 1
The longest contiguous group of strictly increasing tree heights is
Sample Input 2
10
2 1 4 6 8 2 9 5 2 3
Sample Output 2
4
3
Explanation of Sample 2
The longest contiguous group of strictly increasing tree heights is
Comments
hii whoever reading
impasta
hi
i dont get this:(
imposter