Back to problems

Validate Word Abbreviation With Numeric Substrings

Algorithm · Meta · Medium

Problem Given a string word and an abbreviation abbr, determine whether abbr correctly abbreviates word. An abbreviation is formed by replacing any number of non-adjacent substrings of word with the lengths of those substrings. Every numeric substring in abbr must be free of leading zeros. Implement the following function: The strings contain only letters and digits. Examples Example 1 Input: Output: The abbreviation keeps the letters i, i, z, and n, while the numbers…

Checking your access…