#K44667. Longest Productive Segment
Longest Productive Segment
Longest Productive Segment
You are given T binary strings. For each binary string, determine the length of the longest contiguous segment consisting solely of '1's. A segment is defined as a consecutive sequence of characters.
Note: The binary string may contain only the characters '0' and '1'.
Example: For the binary string 1100111110110
, the longest segment of productive fields is 11111
which has length 5.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer T, the number of test cases.
- The next T lines each contain a binary string.
outputFormat
For each test case, output the length of the longest contiguous segment of '1's. The results for all test cases should be printed on a single line separated by a single space.
## sample3
1100111110110
1000001
1111111
5 1 7
</p>