Generalized Abbreviation

Generate all possible generalized abbreviations of a word by replacing consecutive characters with their count. Use backtracking to explore both abbreviating and keeping each character position.

Examples
Input: "word"
Output: ["4","3d","2r1","2rd","1o2","1o1d","1or1","1ord","w3","w2d","w1r1","w1rd","wo2","wo1d","wor1","word"]
Hints

Generalized Abbreviation

Generate all possible generalized abbreviations of a word by replacing consecutive characters with their count. Use backtracking to explore both abbreviating and keeping each character position.