C++ simple, short and easy to read solution
\n    int countSubstrings(string s, string t){\n        int flag=0;  \n            //flag=0 : all chatracters same\n            //flag=1 : 1 chatracter differen
```\n    int countSubstrings(string s, string t){\n        int flag=0;  \n            //flag=0 : all chatracters same\n            //flag=1 : 1 chatracter different\n            //flag=2 : >1 chatracter different\n        int ans=0;\n        int sLen=s.length();\n        int tLen=t.length();\n        for(int i=0; i<sLen; i++)\n            for(int j=0; j<tLen; j++){\n                flag=0;\n                for(int pos=0; i+pos<sLen && j+pos<tLen; pos++){\n                    if(s[i+pos]!=t[j+pos])  //if one diff. in chars seen, increase flag by 1\n                        flag++;\n                    if(flag==2) //if more than 1 char diff\n                        break;\n                    if(flag==1)  //if 1 char diff\n                        ans++;\n\t\t\t\t} \n            }\n        return ans;\n    }\n```
['Dynamic Programming', 'C']