#C14641. Words Grouped by Length

    ID: 44313 Type: Default 1000ms 256MiB

Words Grouped by Length

Words Grouped by Length

Given a list of words, your task is to group the words by their length and output a dictionary where each key represents the word length (an integer), and the corresponding value is a list of words of that length. The ordering of words in each list should be the same as their order in the input.

If the input list is empty, output an empty dictionary {}.

Note: When printing the dictionary, follow the format: {length: ["word1", "word2", ...], ...}

You may assume that words only contain English letters.

Mathematically, if we denote the function by \(f\), then for a list of words \(W = [w_1, w_2, \dots, w_n]\), the output should satisfy:

\[ f(W) = \{\ell \mid \ell = |w| \text{ for } w \in W\}\ \]

inputFormat

The input is read from stdin as a single line. The line contains zero or more words separated by spaces. If the input is empty or consists solely of whitespace, treat it as an empty list of words.

outputFormat

Print to stdout a dictionary (in a Python-like literal string format) where the keys are integers representing word lengths and the values are lists of words (in the order they appear in the input). The format should be exactly like: {3: ["cat", "dog"], 5: ["apple"]}. There should be no extra spaces except for a single space after each colon.

## sample
{}