20190921
A1 100pts 暴力kmp #include<bits/stdc++.h> #define R register int using namespace std; namespace Luitaryi { const int N=100010; char s[N*3],s1[N],s2[N]; int l,l1,l2,nxt1[N],nxt2[N]; vector <int> p1,p2; inline void main() { scanf("%s",s+1); R p=1,q,tmpl=strlen(s+1); while(s[p]!=',') ++p; q=p+1; while(s[q]!=',') ++q; memcpy(s1+1,s+p+1,sizeof(char)*(q-p-1)); memcpy(s2+1,s+q+1,sizeof(char)*(tmpl-q)); l1=q-p-1,l2=tmpl-q,l=p-1; for(R i=2,j=0;i<=l1;i++) { while(j&&s1[i]!=s1[j+1]) j=nxt1[j]; if(s1[j+1]==s1[i]) ++j; nxt1[i]=j; } for(R i=2,j=0;i<=l2;i++) { while(j&&s2[i]!=s2[j+1]) j=nxt2[j]; if(s2[j+1]==s2