#C13891. Group Words by Length
Group Words by Length
Group Words by Length
You are given a list of words. The task is to group these words based on their length. For each unique word length \( L \) (where \( L = len(word) \)), output all the words having that length, preserving their input order. The groups should be printed in increasing order of \( L \).
Note: If the list is empty, no output should be produced.
Example:
Input: 6 apple banana pear kiwi grape Cherry</p>Output: 4: pear, kiwi 5: apple, grape 6: banana, Cherry
inputFormat
The first line of input contains a single integer \( n \), representing the number of words. The next \( n \) lines each contain a single word.
outputFormat
For each unique word length, output a single line in the format:
L: word1, word2, ...
where \( L \) is the word length. The groups must be printed in increasing order of \( L \). If there are no words, output nothing.
## sample6
apple
banana
pear
kiwi
grape
Cherry
4: pear, kiwi
5: apple, grape
6: banana, Cherry
</p>