c++ solution
\nclass Solution {\npublic:\n    int countSubstrings(string s, string t) \n    {\n        int n=s.size();\n        int m=t.size();\n        int ans=0;\n        
```\nclass Solution {\npublic:\n    int countSubstrings(string s, string t) \n    {\n        int n=s.size();\n        int m=t.size();\n        int ans=0;\n        for(int i=0;i<n;i++)\n        {\n            for(int j=0;j<m;j++)\n            {\n                int diff=0;\n                for(int k=0;i+k<n&&j+k<m;k++)\n                {\n                    if(s[i+k]!=t[j+k])\n                    {\n                        diff++;\n                    }\n                    if(diff>1)\n                    {\n                        break;\n                    }\n                    ans+=diff;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C', 'C++']