#abc300f. [abc300_f]More Holidays
[abc300_f]More Holidays
Problem Statement
You are given a string of length consisting of o
and x
, and integers and .
is guaranteed to contain at least one x
.
Let be the string of length obtained by concatenating copies of . Consider replacing exactly x
's in with o
.
Your objective is to have as long a contiguous substring consisting of o
as possible in the resulting .
Find the maximum length of a contiguous substring consisting of o
that you can obtain.
Constraints
- , , and are integers.
- , where is the number of
x
's in the string . - is a string of length consisting of
o
andx
. - has at least one
x
.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
10 1 2
ooxxooooox
Sample Output 1
9
ooxxooooox
and ooxxooooox
.
Replacing x
at the third and fourth characters with o
makes ooooooooox
.
Now we have a length- contiguous substring consisting of o
, which is the longest possible.
Sample Input 2
5 3 4
oxxox
Sample Output 2
8
oxxox
and oxxoxoxxoxoxxox
.
Replacing x
at the and -th characters with o
makes oxxooooooooxxox
.
Now we have a length- contiguous substring consisting of o
, which is the longest possible.
Sample Input 3
30 1000000000 9982443530
oxoxooxoxoxooxoxooxxxoxxxooxox
Sample Output 3
19964887064