Valid Word Abbreviation
Easy · Arrays & Strings · about 15 minutes
Asked at Meta, Google, Bloomberg.
To shorten a word, you can swap some chunks of it for the number of letters in the chunk, as long as the chunks you replace are non-empty and no two of them touch. "substitution" can be shortened to "s10n", "sub4u4" or "12", for instance. A number may not start with 0 (so "s010n" is not allowed).
Report whether abbr is a legal shortening of word.