#C9996. Filter Strings by Length
Filter Strings by Length
Filter Strings by Length
You are given a list of strings and an integer threshold L. Your task is to filter out all strings whose length is strictly greater than L and output them in the original order.
Note: If no string satisfies the condition, output an empty line.
The condition mathematically can be written as: \(\text{len}(s) > L\) for each string \(s\) in the list.
inputFormat
The input is given from standard input (stdin) in the following format:
- The first line contains an integer
n
which represents the number of strings. - If
n > 0
, the second line containsn
space-separated strings. - The last line contains an integer
L
representing the length threshold.
It is guaranteed that the strings do not contain spaces.
outputFormat
Output a single line to standard output (stdout) that contains the filtered strings separated by a single space. If no strings meet the condition, output an empty line.
## sample4
apple berry cherry date
5
cherry