#Z01474. KMP的next数组(板子)

KMP的next数组(板子)

题目描述

给定一个模式串 Plns="http://www.w3.org/1998/Math/MathML"> ,求模式串的next匹配数组

输入格式

第一行输入整数 Nlns="http://www.w3.org/1998/Math/MathML"> (1 Plns="http://www.w3.org/1998/Math/MathML">  的长度。

第二行输入字符串 Plns="http://www.w3.org/1998/Math/MathML">

。(有多组输入)

输出格式

从1到n输出next数组里的值

3
aba
5
ababa
0 0 1 
0 0 1 2 3