题目
思路
这道题是AC自动机模板题。
然后AC自动机其实就是在trie上面跑KMP,然后加上一个next连接边优化就好了。
具体的可以看看YbtOJ实体书上的讲解。
代码
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
using namespace std;
int a[1000010],next[1000010],f[1000010][27];
int T,n,sn,tot;
string s;
queue<int>q;
void add()
{
int dg=0;
for(int i=0; i<sn; i++)
{
int cc=s[i]-97