{"raw_statement":[{"iden":"problem statement","content":"You are given a string $S$ of length $N$ consisting of lowercase English letters. The $x$\\-th $(1 \\le x \\le N)$ character of $S$ is $S_x$.\nFor each $i=1,2,\\dots,N-1$, find the maximum non-negative integer $l$ that satisfies all of the following conditions:\n\n*   $l+i \\le N$, and\n*   for all integers $k$ such that $1 \\le k \\le l$, it holds that $S_{k} \\neq S_{k+i}$.\n\nNote that $l=0$ always satisfies the conditions."},{"iden":"constraints","content":"*   $N$ is an integer such that $2 \\le N \\le 5000$.\n*   $S$ is a string of length $N$ consisting of lowercase English letters."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$S$"},{"iden":"sample input 1","content":"6\nabcbac"},{"iden":"sample output 1","content":"5\n1\n2\n0\n1\n\nIn this input, $S=$ `abcbac`.\n\n*   When $i=1$, we have $S_1 \\neq S_2, S_2 \\neq S_3, \\dots$, and $S_5 \\neq S_6$, so the maximum value is $l=5$.\n*   When $i=2$, we have $S_1 \\neq S_3$ but $S_2 = S_4$, so the maximum value is $l=1$.\n*   When $i=3$, we have $S_1 \\neq S_4$ and $S_2 \\neq S_5$ but $S_3 = S_6$, so the maximum value is $l=2$.\n*   When $i=4$, we have $S_1 = S_5$, so the maximum value is $l=0$.\n*   When $i=5$, we have $S_1 \\neq S_6$, so the maximum value is $l=1$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}