#P1628. 合并序列

合并序列

Description

Given NN words and a string TT, output all words that have TT as a prefix, in lexicographical order.

Input Format

The first line contains a positive integer NN. The next NN lines each contain one word, with length at most 100100. The last line contains the string TT.

Output Format

Output all such words in ascending lexicographical order.

6
na
no
ki
ki
ka
ku
k
ka
ki
ki
ku

Hint

Constraints

  • For 60%60\% of the testdata, 1N10001 \le N \le 1000.
  • For 100%100\% of the testdata, 1N1000001 \le N \le 100000 and all characters are lowercase letters.

Translated by ChatGPT 5