Longest Block of Ones
In a binary string, find the length of the longest block of consecutive 1s.
Input: one line with a binary string.
Output: the longest run of 1s (0 if there are none).
Constraints:
- 1 ≤ |S| ≤ 105
Sample Tests
Input 1
110111
Output 1
3
Input 2
000
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.