No.2298 yukicounter
タグ : / 解いたユーザー数 177
作問者 :
Problem Statement
You are given a string $S$ consisting of lowercase English letters. Find the maximum number of times the string yukicoder appears consecutively in $S$.
More precisely, find the maximum non-negative integer $K$ satisfying the following condition.
- Let $T$ be the string obtained by repeating the string
yukicoder$K$ times. Then $T$ is a contiguous substring of $S$.
Constraints
- $S$ is a string consisting of lowercase English letters with length at least $9$ and at most $10^6$.
Input
The input is given from Standard Input in the following format.
$S$
Output
Print the answer.
Sample
Sample 1
Input
yukicoderaayukicoderyukicoder
Output
2
As shown by yukicoder aa yukicoderyukicoder, $S$ has a part where yukicoder appears $1$ time consecutively and a part where it appears $2$ times consecutively.
Of these, print the larger value, $2$. Note that the occurrences must be consecutive.
Sample 2
Input
codeforces
Output
0
The string obtained by repeating yukicoder $0$ times is the empty string, and the empty string is a substring of $S = $ codeforces.
Sample 3
Input
yukicoderyukicoderyukicoderyukicoderyukiyukicoderyukicoderyukicoder
Output
4
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。