KMP字符串匹配
首先写出子串的next数组,即前缀和后缀相等的最大值
如abaabba,next数组的下标表示子串下标所在的字符串
next[0] = 0 a
next[1] = 0 ab
next[2] = 1 aba a
next[3] = 1 abaa a
next[4] = 2 abaab ab
next[5] = 0 abaabb
next[6] = 0 abaabba
之后对子串和母串进行对比,记录对比的各自的下标值,如果不匹配,则j = next[j-1];然后将下标为j的子串再与之前为匹配的进行比较