MAP || C++ || EASY || SIMPLE || TIME O(n^2log(n))
\nclass Solution {\npublic:\n    int check(string s1,string s2){\n        // cout<<s1<<" "<<s2<<endl;\n        int k = 0;\n        int i,n = s1.length();\n     
```\nclass Solution {\npublic:\n    int check(string s1,string s2){\n        // cout<<s1<<" "<<s2<<endl;\n        int k = 0;\n        int i,n = s1.length();\n        for(i = 0; i < n; i++){\n            if(s1[i] != s2[i]){\n                k++;\n            }\n        }\n        return k;\n    }\n    int countSubstrings(string s, string t) {\n        unordered_map<string,int> m1,m2;\n        int k = min(s.length(),t.length());\n        string str = "";\n        int i,j,n = s.length();\n        for(i = 0; i < n; i++){\n            str = "";\n            for(j = i; j < n && (j-i)<k ; j++){\n                str += s[j];\n                m1[str]++;\n            }\n        }\n        n = t.length();\n        for(i = 0; i < n; i++){\n            str = "";\n            for(j = i; j < n && (j-i) < k; j++){\n                str += t[j];\n                m2[str]++;\n            }\n        }\n        // for(auto &i: m1){\n        //     cout<<i.first<<" "<<i.second<<endl;\n        // }for(auto &i: m2){\n        //     cout<<i.first<<" "<<i.second<<endl;\n        // }\n        int ans = 0;\n        for(auto &i: m1){\n            \n            for(auto &j: m2){\n                if(((i.first).length() == (j.first).length()) && (check(i.first,j.first)==1)){\n                    ans += i.second * j.second;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C', 'C++']