#C12951. Filter Strings by Length

    ID: 42435 Type: Default 1000ms 256MiB

Filter Strings by Length

Filter Strings by Length

Given a list of strings and an integer threshold n, your task is to output every string from the list whose length is greater than or equal to n. The input is provided via standard input (stdin) and the output should be written to standard output (stdout). The order of the strings must be preserved.

Formally, if the list of strings is \(S = [s_1, s_2, \dots, s_m]\) and the threshold is \(n\), you should output all strings \(s_i\) for which \(|s_i| \ge n\). If no strings meet the condition, output nothing.

inputFormat

The first line contains a positive integer \(m\) indicating the number of strings in the list. The next \(m\) lines each contain a non-negative string. The last line contains a positive integer \(n\), the minimum length required for a string to be included in the output.

Example Input:

4
apple
banana
pear
kiwi
5

outputFormat

Output each string that has length greater than or equal to \(n\) on a new line, maintaining the order of appearance in the input. If no string qualifies, do not output anything.

Example Output:

apple
banana
## sample
4
apple
banana
pear
kiwi
5
apple

banana

</p>