#ARC110B. [ARC110B] Many 110
[ARC110B] Many 110
Score : points
Problem Statement
Let be the concatenation of copies of the string 110. (For reference, the concatenation of copies of 110 is 110110110.)
We have a string of length .
Find the number of times occurs in as a contiguous substring.
Constraints
- is a string of length consisting of
0and1.
Input
Input is given from Standard Input in the following format:
Output
Print the number of times occurs in as a contiguous substring.
4
1011
9999999999
is so long, so let us instead count the number of times 1011 occurs in the concatenation of copies of 110, that is, 110110110. We can see it occurs twice:
-
1011 -
1011
22
1011011011011011011011
9999999993