{"raw_statement":[{"iden":"problem statement","content":"Given is a string $S$ of length $N$.\nFind the maximum length of a non-empty string that occurs twice or more in $S$ as contiguous substrings without overlapping.\nMore formally, find the maximum positive integer $len$ such that there exist integers $l_1$ and $l_2$ ( $1 \\leq l_1, l_2 \\leq N - len + 1$ ) that satisfy the following:\n\n*   $l_1 + len \\leq l_2$\n    \n*   $S[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)$\n    \n\nIf there is no such integer $len$, print $0$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 5 \\times 10^3$\n*   $|S| = N$\n*   $S$ consists of lowercase English letters."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$S$"},{"iden":"sample input 1","content":"5\nababa"},{"iden":"sample output 1","content":"2\n\nThe strings satisfying the conditions are: `a`, `b`, `ab`, and `ba`. The maximum length among them is $2$, which is the answer. Note that `aba` occurs twice in $S$ as contiguous substrings, but there is no pair of integers $l_1$ and $l_2$ mentioned in the statement such that $l_1 + len \\leq l_2$."},{"iden":"sample input 2","content":"2\nxy"},{"iden":"sample output 2","content":"0\n\nNo non-empty string satisfies the conditions."},{"iden":"sample input 3","content":"13\nstrangeorange"},{"iden":"sample output 3","content":"5"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}