Leaders in an Array
An element is a leader if it is strictly greater than every element to its right (the last element is always a leader). Print the leaders in their original order.
Input
, then integers.
Output
The leaders.
Constraints
Sample 1
Input
6 16 17 4 3 5 2
Output
17 5 2