{"problem":{"name":"Who Says a Pun?","description":{"content":"Given is a string $S$ of length $N$. Find the maximum length of a non-empty string that occurs twice or more in $S$ as contiguous substrings without overlapping. More formally, find the maximum positi","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc141_e"},"statements":[{"statement_type":"Markdown","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$.\n\n## Constraints\n\n*   $2 \\leq N \\leq 5 \\times 10^3$\n*   $|S| = N$\n*   $S$ consists of lowercase English letters.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$S$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc141_e","tags":[],"sample_group":[["5\nababa","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$."],["2\nxy","0\n\nNo non-empty string satisfies the conditions."],["13\nstrangeorange","5"]],"created_at":"2026-03-03 11:01:14"}}