View Code
1 #include2 #include 3 char str1[100010]; 4 char str2[50005]; 5 int next[1000010]; 6 int max(int x,int y) 7 { 8 return x=x>y?x:y; 9 }10 void get_next(int x)11 {12 13 int i=0,j=-1;14 next[0]=-1;15 while(i len1)42 {43 ans=next[ans];44 45 }46 while(ans>len2)47 {48 ans=next[ans];49 50 }51 for(int i=0;i