A digital machine generates binary data which consists of a string of 0s and 1s. A maximum signal M. in the data, consists of the maximum number of either 1s or Os appearing consecutively in the data but M can't be at the beginning or end of the string. Design a way to find the length of the maximum signal.
Input
The first line of the input consists of an integer N, representing the length of the binary string. The second line consists of a string of length N consisting of Os and is only.
Output
Print an integer representing the length of the maximum signal.
Example:
Input
6
101000
output
1
Answers
Answered by
1
Answer:
The first line of the input consists of an integer – N, representing the total number of apples that Josh wants to buy.
The second line consists of two space-separated positive integers – M1 and P1, representing the number of apples in a lot and the lot’s price at shop A, respectively.
The third line consists of two space-separated positive integers-M2 and P2, representing the number of apples in a lot’s price at shop B, respectively.
Similar questions