#include #include #include #include #include #include #include #include #include #include #include #define MAXN 1111111 #define MAXM 211111 #define PI acos(-1.0) #define eps 1e-8 #define INF 1e10 using namespace std; int A[MAXN], B[MAXN]; char sa[MAXN]; void preExKmp(char x[],int m,int A[]){ int ind=0,k=1; A[0]=m; while (ind + 1 < m && x[ind+1]==x[ind]) ++ind; A[1]=ind; for (int i=2;i= A[i]) { res = A[i]; break; } } printf("%d\n", res); } return 0; }