You are given a binary string S of length N. Where a character at ith position signifies the signal level of an antenna at ith second.
0 represents low signal and 1 represents high signal.
What is the maximum consecutive time(in seconds) for which the signal was high?
Function Description
Complete the function solve provided in the editor. This function takes the following one parameter and returns the required answer:
N: the size of the binary string.
S: the binary string.
Input Format
Note: This is the input format that you must use to provide custom input (available above the Compile and Test button).
The first line contains T denoting the number of test cases. T also specifies the number of times you have to run the solve function on a different set of inputs.
For each test case:
Output Format
For each test case, print the answer in a new line.
Constraints
1≤T≤10
1≤N≤105
Code snippets (also called starter code/boilerplate code)
This question has code snippets for C, CPP, Java, and Python.
Signal was high during last 3 second for the longest consecutive time. Thus the answer is 3.