2068. Check Whether Two Strings are Almost Equivalent
On This Page
class Solution:
def checkAlmostEquivalent(self, word1: str, word2: str) -> bool:
cnt = Counter(word1)
for c in word2:
cnt[c] -= 1
return all(abs(x) <= 3 for x in cnt.values())