摘要:
#include<stdio.h>#include<stdlib.h>#include<string.h>#define N 1000005int next[N],len1,len2,ans;char s1[N],s2[N];void getnext(){ int k,j; len1=strlen(s1); next[0]=-1; j=0; k=-1; while(j<len1){ if(k==-1||s1[k]==s1[j]){ k++; j++; next[j]=k; } else k=next[k]; } return ;}int kmp(){ 阅读全文