#K33787. Maximum Increase in Plant Height
Maximum Increase in Plant Height
Maximum Increase in Plant Height
A renowned botanist is studying the growth patterns of a particular plant species. Daily height measurements have been recorded over several periods. For each period, you are provided with the number of days followed by the plant's height on each day. Your task is to determine the maximum increase in height observed during each period. The increase is defined as the difference between the height on a later day and an earlier day. If there is no day with an increase in height, then the maximum increase is \(0\).
The input terminates when a period starts with \( n = 0 \).
inputFormat
The input is given from stdin as a sequence of integers separated by spaces or newlines. Each dataset begins with an integer \( n \) which indicates the number of days in that period, followed by \( n \) integers representing the daily heights. The input terminates when \( n = 0 \) is encountered.
outputFormat
For each period, print the maximum increase in height on a single line, with each result separated by a space, to stdout.
## sample5 10 11 7 10 6 4 75 75 75 75 6 1 3 2 6 2 5 0
3 0 5