#P2322. [HNOI2006] 最短母串问题
[HNOI2006] 最短母串问题
Description
Given strings , find the shortest string such that all strings are substrings of .
Input Format
The first line contains an integer , the number of given strings. The next lines each contain a string consisting only of uppercase letters.
Output Format
Output a single line containing the shortest string . Among all shortest candidates, if there are multiple strings that satisfy the requirement, output the lexicographically smallest one.
2
ABCD
BCDABC
ABCDABC
Hint
For of the testdata, , and the length of each string does not exceed .
Translated by ChatGPT 5
京公网安备 11011102002149号