classSolution: defcamelMatch(self, queries: List[str], pattern: str) -> List[bool]: result = [] for i in range(len(queries)): res = self.match(queries[i], pattern) result.append(res) return result
defmatch(self, query, pattern): i = 0 j = 0 while i < len(query) and j < len(pattern): if query[i] == pattern[j]: i += 1 j += 1 else: if query[i].isupper(): returnFalse else: i += 1
if j == len(pattern) and (i == len(query) or query[i:].islower()): returnTrue returnFalse