Problems > Longest Zero Gap

Longest Zero Gap

Difficulty: 900 2000 ms 128 MB

strings

Print the length of the longest block of consecutive 0s.

Input: one line with a binary string.

Output: the longest run of 0s (0 if none).

Constraints:

  • 1 ≤ |S| ≤ 105

Sample Tests

Input 1
100010
Output 1
3
Input 2
111
Output 2
0

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.