开头准备: #include<iostream> #include<cstdio> using namespace std; #define MAXN 100 int next[MAXN]; 生成next数组的函数: void getnext(string pattern){ int m = pattern.size(); int j = 0; next[j] = -1; int ...