远古老题kmp+hash
题义: 要求找到一个在s原字符串开端,中间,结尾都出现过的子字符串(可能无解)。
思路: 利用kmp中ne数组的定义,结尾与开端相同的最大子字符串的长度,通过预处理出原字符串的ne数组,哈希桶记录2到n-1的的ne值,while循环ne[n],得到最大合法子字符串
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<bitset>
#include<cmath>
#include<array>
#include<atomic>
#include<sstream>
#include<stack>
#include<iomanip>
//#include<bits/stdc++.h>
//#define int ll
#define pb push_back
#define endl '\n'
#define x first
#define y second
#define Endl endl
#define pre(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,b,a) for(int i=b;i>=a;i--)
#define si(x) scanf("%d", &x);
#define sl(x) scanf("%ll