#C13638. Filter and Sort Words
Filter and Sort Words
Filter and Sort Words
You are given a single line containing a list of words separated by spaces, and a second line containing an integer length. Your task is to filter out all words that are shorter than length and then output the remaining words sorted in reverse alphabetical order (case-insensitive). In other words, if we denote the lowercase of word w as \(w.lower()\), then the sorted order is determined by comparing \(w.lower()\) in descending order. The original case of each word should be preserved in the output.
Input Format: The first line contains a list of words separated by spaces. The second line contains a single integer representing the minimum word length.
Output Format: Print the filtered words in one line separated by a single space, following the sorted order as described. If no words satisfy the condition, output an empty line.
inputFormat
The first line contains space-separated words. The second line contains an integer length.
Example:
apple banana grape kiwi 5
outputFormat
Output the words that have a length greater than or equal to the given integer, sorted in reverse alphabetical order (ignoring case), separated by a space.
For the example input above, the output is:
grape banana apple## sample
apple banana grape kiwi
5
grape banana apple