Олимпиадный тренинг

Задача 34917. The greatest length of a monotone fragment


Задача

Темы: Цикл while

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

Numbers after 0 do not need to be read.

Input: Given a sequence of natural numbers ending in 0.

Output: Print the answer to the problem.

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

Запрещенные операторы:list