直接用Trie树即可. 每个节点统计经过该点的单词数,遍历时当经过的单词数为1时即为合法的前缀. type arr=record next:array['a'..'z'] of longint; w:longint; end; ; ..maxn] of arr; s:..maxn] of ansistring; i,j,m,n,now,num:longint; begin while not eof do begin inc(n); readln(s[n]); end; num:=; to n…