c++ Brute force but efficient 4ms
\nclass Solution {\npublic:\n    int countSubstrings(string s, string t) {\n        int ans = 0;\n        for(int i=0;i<s.length();i++){\n            for(int j=
```\nclass Solution {\npublic:\n    int countSubstrings(string s, string t) {\n        int ans = 0;\n        for(int i=0;i<s.length();i++){\n            for(int j=0;j<t.size();j++){\n                int x = i;\n                int y = j;\n                int d = 0;\n                while(x<s.length()&&y<t.length()){\n                    if(s[x]!=t[y])\n                        d++;\n                    if(d==1) ans++;\n                    if(d==2) break;\n                    \n                    x++;\n                    y++;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
[]