Generalized abbreviations
Your task
A word's generalized abbreviation replaces any number of non-overlapping, non-adjacent groups of consecutive characters by the count of characters removed. Given a word, return ALL of its generalized abbreviations. For example 'word' yields forms like 'word', '1ord', 'w1rd', '4', '2rd', etc. Return them sorted lexicographically. The word has at most 12 lowercase letters.
Examples
generate_abbreviations(word: str) -> list[str]Example 1
Input
generate_abbreviations("a")Output
["1", "a"]