237. Valid Word Abbreviation
EasyString
A string can be abbreviated by replacing any number of non-adjacent, non-empty substrings with their lengths. The lengths should not have leading zeros. For example, a string such as "substitution" could be abbreviated as (but not limited to): "s10n", "sub4u4", "12", "su3i1u2on". Given a string word and an abbreviation abbr, return whether the string matches the given abbreviation.
Examples
Input: internationalization i12iz4n
Output: true
Explanation: i + skip 12 + iz + skip 4 + n matches.
Constraints
- 1 <= word.length <= 20
- word consists of only lowercase English letters.
- 1 <= abbr.length <= 10
- abbr consists of lowercase English letters and digits.
- All the integers in abbr will fit in a 32-bit integer.
Loading...
Run checks all cases above. Submit evaluates all test cases.