#K75222. Longest Contiguous Ones

    ID: 34372 Type: Default 1000ms 256MiB

Longest Contiguous Ones

Longest Contiguous Ones

You are given a binary string consisting of characters '0' and '1'. Your task is to compute the length of the longest contiguous segment of '1's in the given string.

Formally, if the binary string is denoted as S and if we define a segment as a consecutive substring of S such that every character in the segment is '1', then you must determine the maximum length among all such segments.
This can be represented in latex as: $$\max_{1 \leq i \leq n}{\left| \{j \mid S_j = 1 \text{ and } S_{j+1} =1 \text{ ... consecutive} \} \right|}.$$ (Note: this is a conceptual representation, not a formal mathematical definition.)

The input will be provided via standard input and the output should be printed to standard output.

inputFormat

The input consists of a single line containing a binary string composed of '0's and '1's. The string may be large, so use efficient methods to process it.

Example Input:

110011111010111

outputFormat

Output a single integer representing the length of the longest contiguous sequence of '1's in the input string.

Example Output:

5
## sample
110011111010111
5