字典树算法讲解可以看其他题解 这里给出一版比较简单的代码 #include <iostream> #include <vector> #include <algorithm> using namespace std; using ll = long long; const int N=1e6+1; char s[N]; int ch[N][70],cnt[N],idx; void insert(string s){ int p=0; for(int i=0;s[i];i++){ int j; j=s[i]-'A'; if(!ch[p][j]){ ch[p][...