1
from functools import lru_cache5
def findGoodStrings(self, n: int, s1: str, s2: str, evil: str) -> int:7
return [chr(i) for i in range(ord(a), ord(b) + 1)]13
if pat[i] == pat[target]:18
target = lps[target - 1]28
def dfs(i, max_matched_idx, lb, rb):29
if max_matched_idx == len(evil):33
l = s1[i] if lb else "a"34
r = s2[i] if rb else "z"35
candidates = srange(l, r)37
for j, c in enumerate(candidates):38
nxt_matched_idx = max_matched_idx39
while evil[nxt_matched_idx] != c and nxt_matched_idx:40
nxt_matched_idx = lps[nxt_matched_idx - 1]45
nxt_matched_idx + (c == evil[nxt_matched_idx]),47
rb=(rb and j == len(candidates) - 1),52
return dfs(0, 0, True, True)