Module: (C++) Tasks for using a while loop


Problem

8 /9


Maximum length of a monotone fragment

Problem

Given a sequence of natural numbers ending with the number 0. Determine the maximum length of a monotone fragment of the sequence (that is, such a fragment where all elements are either greater than the previous one or less).

Input
A sequence of natural numbers is entered, ending with the number 0 (the number 0 itself is not included in the sequence, but serves as a sign of its termination).

Imprint 
Print the answer to the problem.
 

 

Examples
# Input Output
1 9
7
7
9
7
0
2