#K5341. Filter Words by Length

    ID: 29525 Type: Default 1000ms 256MiB

Filter Words by Length

Filter Words by Length

Your task is to implement a function that filters words by a given length. You are given a list of words and an integer (n). You need to return all the words from the list that have exactly (n) characters.

For example, if the list is ["apple", "pear", "banana", "fig", "kiwi"] and (n = 4), the correct output is "pear kiwi".

inputFormat

Input is read from standard input (stdin).

The first line contains an integer (m), the number of words.
The second line contains (m) space-separated words.
The third line contains an integer (n), indicating the required word length.

outputFormat

Output the filtered words in the order they appear, separated by a space. If no word matches, output an empty line.## sample

5
apple pear banana fig kiwi
4
pear kiwi

</p>