Rokt surface rules can represent repeated arbitrary characters compactly. Given an encoded pattern s1 and a candidate string s2, return True if the pattern matches the entire string, otherwise return False.
In s1, each . matches exactly one arbitrary character. A maximal run of decimal digits represents that many consecutive arbitrary characters. For example, a3b matches aXYZb, and a12b matches a followed by any 12 characters and then b. Every other character is a literal and must match exactly. Digit runs are counts, not literal characters.
The pattern must consume all of s2; partial matches are invalid. Do not expand counted wildcards into an intermediate string because a count may be much larger than the encoded pattern.
Implement match_pattern(s1, s2), where both inputs are strings. Return a boolean indicating whether the complete pattern s1 matches the complete string s2.
def match_pattern(s1, s2):