#K34207. Longest Sunny Streak

    ID: 25258 Type: Default 1000ms 256MiB

Longest Sunny Streak

Longest Sunny Streak

In this problem, you are given a sequence of days represented by integers. A value of (1) indicates a sunny day, and (0) indicates a non-sunny day. Your task is to determine the length of the longest consecutive sequence of sunny days. For example, if the weather sequence is given by (days = [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1]), the longest sunny streak is (4).

You need to read the input from standard input (stdin) and output the result to standard output (stdout). This problem tests your ability to process arrays and implement simple counting mechanisms.

inputFormat

The input consists of two lines:\ The first line contains a single integer (n) which represents the number of days.\ The second line contains (n) space-separated integers, each being either (0) or (1), where (1) represents a sunny day and (0) represents a non-sunny day.

outputFormat

Output a single integer, the length of the longest sequence of consecutive sunny days.## sample

11
1 1 0 1 1 1 0 1 1 1 1
4