~/algor $ cat problems/array/elements-greater-than-the-previous
Elements greater than the previous
Easy
1000 ms
128 MB
30%
A positive integer and an array of integers are given. Print the number of elements strictly greater than their previous neighbour, and these elements themselves in input order.
Input
The first line contains a positive integer . The second line contains integers separated by spaces.
Output
The first line contains one integer — the number of such elements . If , the second line contains these elements separated by spaces (if there are no such elements, only is printed).
Note
Examples
Input #1
6 3 8 5 12 15 9
Output #1
3 8 12 15
Input #2
4 5 4 3 2
Output #2
0