← 返回 meta 的题目列表Valid Word Abbreviation
类型:online_judge
Given a pattern and its abbreviation, determine if the input string matches it, similar to internationalization abbreviations (e.g., i18n), such as:
'f6k' should match 'facebook', but not 'focus'
'F2eb2k' or '8' should match 'Facebook'
Implement a function match(pattern: str, word: str) -> bool to check if the pattern matches the word.
Example Inputs and Outputs:
match('8k', 'Facebook') returns False
match('8k', 'Faceboook') returns True
match('F2eb2k', 'Facebook') returns True
Example
Input
'8k' 'Facebook'