Python easy to understand O(mn) 100% time
\nclass Solution:\n    def countSubstrings(self, s: str, t: str) -> int:\n        \n        @lru_cache(None)\n        def count(ssub, tsub):\n            if not
```\nclass Solution:\n    def countSubstrings(self, s: str, t: str) -> int:\n        \n        @lru_cache(None)\n        def count(ssub, tsub):\n            if not ssub or not tsub:\n                return 1\n            if ssub[0] != tsub[0]:\n                return 1\n            return 1 + count(ssub[1:], tsub[1:])\n        \n        output = 0\n        for i in range(len(s)):\n            for j in range(len(t)):\n                if s[i] != t[j]:\n                    output += count(s[:i][::-1], t[:j][::-1]) * count(s[(i + 1):], t[(j + 1):])\n                \n        return output\n```
[]