#arc110b. [arc110_b]Many 110
[arc110_b]Many 110
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
0
and1
.
Input
Input is given from Standard Input in the following format:
Output
Print the number of times occurs in as a contiguous substring.
Sample Input 1
4
1011
Sample Output 1
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
Sample Input 2
22
1011011011011011011011
Sample Output 2
9999999993