[Python3] Brutal force with HashTable(dictionary)
Idea:\n1. For s: store all the possible matches in a dictionary, and do the encoding with "\". The key is the possible match and the value is the substring itse
Idea:\n1. For s: store all the possible matches in a dictionary, and do the encoding with "\\*". The key is the possible match and the value is the substring itself\nFor example, "ab"=> {\'a*\': \'ab\', \'*b\': \'ab\'}\n2. For t: check each substring of t, and find its corresponding matches in the dictionary, add to result. Counter() is used to count the number of matches for a given matching value\n\nNote: the substring is [i:j ), so j should be len(s) + 1 \n```\nclass Solution:\n    def countSubstrings(self, s: str, t: str) -> int:\n        d = defaultdict(list)\n        for i in range(len(s)+1):\n            for j in range(i):\n                substring = s[j:i]\n                if len(substring):\n                    for k in range(len(substring)):\n                        n = substring[:k] + "*" + substring[k+1:]\n                        d[n].append(substring) \n        count = 0\n        for i in range(len(t)+1):\n            for j in range(i):\n                substring = t[j:i]\n                if len(substring):\n                    for k in range(len(substring)): \n                        n = substring[:k] + "*" + substring[k+1:]\n                        if d[n]:\n                            chances = d[n]\n                            c = Counter(chances)\n                            for sub in c:\n                                if substring != sub:\n                                    count += c[sub]\n        \n        return count\n        \n```
[]