#include<cstdio> #include<cstring> #include<cstdlib> void GetNext(char *t,int *next){ ,j = ; next[] = ; ]){ || t[i] == t[j]){ i++; j++; if(t[i]!=t[j]){ next[i] = j; }else{ next[i] = next[j]; } }else{ j = next[j]; } } } int index_kmp(char *s,char *t,int pos){ int i = pos; ; ]; GetNext(t,next); ] && j<=t[]){ == j||s[i] == t[j]){ i++; j++; }else{ j = next[j]; } } ]){ ]; }else{ ; } } int main(){ ] = " aaaas"; ]; t[] = strlen(t)-; )){ s[] = strlen(s); printf()); } ; }