#K8041. Filter Strings by Length
Filter Strings by Length
Filter Strings by Length
You are given a list of strings and an integer n. Your task is to filter the list and output only those strings whose length is strictly greater than n. This problem requires you to process a series of inputs from standard input and print the result to standard output.
Make sure to handle edge cases: the input list might be empty, and n can be negative. When no string qualifies, your program should output an empty line.
inputFormat
The input is read from standard input and is formatted as follows:
- The first line contains an integer
n
– the length threshold. - The second line contains an integer
m
– the number of strings. - The following
m
lines each contain a single string.
outputFormat
Output a single line to standard output containing the filtered strings separated by a single space. If no string qualifies, output an empty line.
## sample5
5
apple
pear
banana
kiwi
strawberry
banana strawberry