Count Substrings That Differ by One Character LeetCode solution in Python
1class Solution:2def countSubstrings(self, s: str, t: str) -> int:3res = 04for i in range(len(s)):5for j in range(len(t)):6miss, pos = 0, 07while i + pos < len(s) and j + pos < len(t) and miss < 2:8miss += s[i + pos] != t[j + pos]9res += miss == 110pos += 111return res