#K82787. Words Above Threshold
Words Above Threshold
Words Above Threshold
You are given an integer \(n\) representing the number of words, followed by a list of \(n\) words and an integer \(k\) representing the threshold. Your task is to find all the words that appear more than \(k\) times in the list. The resulting words should be output in alphabetical order.
Input Format: The first line contains an integer \(n\). The second line contains \(n\) words separated by spaces. The third line contains the integer \(k\).
Output Format: Output a single line consisting of the words that appear more than \(k\) times, sorted alphabetically and separated by a single space. If no words meet the condition, output an empty line.
Example:
Input: 10 apple banana apple grape banana apple orange banana grape apple 2</p>Output: apple banana
inputFormat
The input is read from standard input (stdin) and consists of three parts:
- An integer \(n\) on the first line, representing the total number of words.
- A line with \(n\) space-separated words.
- An integer \(k\) on the next line, the threshold.
outputFormat
The output is a single line to standard output (stdout), which contains the words that appear more than \(k\) times in alphabetical order, separated by a single space. If there are no such words, output an empty line.
## sample10
apple banana apple grape banana apple orange banana grape apple
2
apple banana