input:
lebronjamesisgoat
goat
output:
13
-1 0 0 0
思路:
emmm感觉还是似懂非懂,照着ppt的方法敲了C++做法而易,并不是很理解
#include#include #include #include using namespace std; const int maxn=111111; int maxx=-0x3f3f3f3f; char t[maxn],p[maxn]; int flink[maxn]={-1}; int lt,lp; void solveflink(char p[]) { int j=1,k; while(j >t>>p; lt=strlen(t); lp=strlen(p); solveflink(p); int ans=kmpmatch(); cout<



