#P9364. [ICPC2022 Xi'an R] Perfect Word
[ICPC2022 Xi'an R] Perfect Word
题目描述
You are given strings and required to find the length of the longest perfect word.
A string is called a perfect word, if and only if every non-empty substring of appears in the given strings.
A string is called a substring of if and only if it can be obtained by removing several (possibly zero) characters from the beginning or end of .
输入格式
The first line contains a single integer ().
Each of the next lines contains a string consisting of lowercase English letters.
It is guaranteed that the total length of the given strings is no more than .
输出格式
Output an integer, representing the length of the longest perfect word.
题目大意
题目描述
给定 个字符串,你需要找到最长的「完美单词」。
字符串 称为「完美单词」,当且仅当它的所有非空子串都出现在给定的字符串中。
字符串 称为 的子串,当且仅当 可由 在开头和结尾分别删去零个或若干个字符得到。
,字符串仅由小写字母组成,且总长不超过 。
输入格式
第一行一个整数 。
接下来 行,每行一个字符串。
输出格式
输出一行一个整数表示最长的「完美单词」的长度。
4
a
t
b
ab
2
提示
Source: The 2022 ICPC Asia Xi'an Regional Contest Problem G.
Author: MonkeyKing.