KMP算法基本版:
// next数组的求法
void getNext(SString T, int* next)
{
int j = 0, i = 1;
while (i < T.len)
if (j == 0 || T.arr[j] == T.arr[i])
j++, i++;
next[i] = j;
}
else
j = next[j];