模式串为子串
KMP
/* @author : victor */ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX = 5e6 + 7; int next_[MAX]; char s1[MAX], s2[MAX], ans[MAX]; int pos[MAX]; int l1, l2, cnt; void get_next(char x[],int m,int next_[]) { int i ,j; j = next_[0] = -1; i = 0; while(i < m){ while(-1!=j&&x[i]!=x[j]) j = next_[j]; next_[++i] = ++j; } } void KMP(){ int i = 0, j = 0; cnt = 0; while(s1[i] != '