Given a list of words, return a dictionary mapping each word length to the list of words of that length, in the order they appear in words. Duplicated words stay duplicated.
Examples
Input: words = ["hi", "sun", "yo", "a"]
Output: {2: ["hi", "yo"], 3: ["sun"], 1: ["a"]}
Constraints
0 <= len(words) <= 10**5- Target complexity: O(total characters).
Goals
- Group items by a computed key
- Preserve original order inside each group