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 Christmas trees, numbered from to . Each of them has a height value, with the th tree being assigned a height 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, , representing the number of Christmas trees.
The second line contains space-separated integers, with the th integer on the second line representing the value , or the height of the th tree.
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 , which has a length of . The longest contiguous group of strictly decreasing tree heights is , which has a length of .
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 , which has a length of . The longest contiguous group of strictly decreasing tree heights is , which has a length of .
Comments
hii whoever reading
impasta
hi
i dont get this:(
imposter