#K46727. Predict Words by Prefix
Predict Words by Prefix
Predict Words by Prefix
You are given a list of words and a prefix string. Your task is to find all the words in the list that start with the given prefix and print them in lexicographical order.
If no word in the list matches the prefix, then print No match found
.
The input is given through standard input and the output should be printed on standard output.
Note: The lexicographical order is determined by the standard dictionary order.
inputFormat
The input is read from the standard input and is formatted as follows:
- The first line contains an integer \( n \), the number of words.
- The next \( n \) lines each contain one word from the dictionary.
- The last line contains the prefix string.
outputFormat
If there are words that start with the given prefix, print each matching word on a separate line in lexicographical order.
If no word matches the prefix, print exactly No match found
.
5
apple
app
application
apricot
banana
app
app
apple
application
</p>