int nxt[maxn],ex[maxn];
void ex_kmp(char *s1,const char *s2)
{
int len1=strlen(s1),len2=strlen(s2);
nxt[0]=len1;nxt[1]=0;
while (1+nxt[1]<len1 && s2[nxt[1]]==s2[1+nxt[1]])
nxt[1]++;
int pos=1,mr=1+nxt[1];
for (int i=2;i<len2;++i){
if (i<mr)
nxt[i]=min(i+nxt[i-pos],mr)-i;
else
nxt[i]=0;
while (i+nxt[i]<len2 && s2[nxt[i]]==s2[i+nxt[i]])
nxt[i]++;
if (i+nxt[i]>mr){
mr=i+nxt[i];
pos=i;
}
}
pos=-1;
mr=0;
for (int i=0;i<len1;++i){
if (i<mr)
ex[i]=min(i+nxt[i-pos],mr)-i;
else
ex[i]=0;
while (ex[i]<len2 && i+ex[i]<len1 && s2[ex[i]]==s1[i+ex[i]])
ex[i]++;
if (i+ex[i]>mr){
mr=i+ex[i];
pos=i;
}
}
}