Back to problems

Validate a Generalized Word Abbreviation

Algorithm · Salesforce · Medium

Given a lowercase English word word and a string abbreviation, decide whether abbreviation is a valid abbreviation of word. A valid abbreviation is processed as follows. Each lowercase letter in abbreviation must match the next unconsumed character of word; if it matches, that character is consumed. Each contiguous run of digits in abbreviation is parsed as one positive integer skip count, which advances the current position in word by that many characters without comparing…

Checking your access…