Python solution with comments
class Solution:\n\n    def countSubstrings(self, s: str, t: str) -> int:\n        ans = 0\n        for i in range(len(s)): # for every substring starting with s
class Solution:\n\n    def countSubstrings(self, s: str, t: str) -> int:\n        ans = 0\n        for i in range(len(s)): # for every substring starting with s[i], we search all possible starting index in t\n            for j in range(len(t)):\n                start_s, start_t = i, j\n                count = 0\n                while(start_s<len(s) and start_t<len(t)):\n                    if s[start_s]!=t[start_t]: # if current letter is different, add one to the count\n                        count+=1\n                    if count==1: # only if count == 1 we add 1 to the ans\n                        ans+=1\n                    if count>=2: # early stop for two or more diffferent letters\n                        break\n                    start_s+=1\n                    start_t+=1\n        return ans
['Python']