C++ Solution || Backtracking + Predicate Function ||
\nclass Solution {\npublic:\n    \n    bool predicate(string sub1, string sub2)\n    {\n        if(sub1.size() == 0 || sub2.size() == 0) return false;\n        
```\nclass Solution {\npublic:\n    \n    bool predicate(string sub1, string sub2)\n    {\n        if(sub1.size() == 0 || sub2.size() == 0) return false;\n        if(sub1.size() != sub2.size()) return false;\n        int count = 0, i = 0;\n        while(true)\n        {\n            if(i == sub1.size() || i == sub2.size())\n            {\n                break;\n            }\n            \n            if(sub1[i] != sub2[i]) count += 1;\n            \n            i++;\n        }\n        \n        if(count == 1 && i == sub1.size() && i == sub2.size()) return true;\n        return false;\n    }\n    \n    void substr(string str, string sub, vector<string> &v, int i)\n    {\n        if(i == str.size())\n        {\n            if(sub.size() != 0)\n            {\n                v.push_back(sub);\n            }\n            return;\n        }\n        \n        sub.push_back(str[i]);\n        substr(str, sub, v, i+1);\n        sub.pop_back();\n        if(sub.size() != 0)\n        {\n            v.push_back(sub);\n            sub.clear();\n            return;\n        }\n        substr(str, sub, v, i+1);\n    }\n    \n    int countSubstrings(string s, string t) {\n        \n        string s1, s2;\n        vector<string> sub1, sub2;\n        int count = 0;\n        \n        substr(s, s1, sub1, 0);\n        substr(t, s2, sub2, 0);\n        \n        for(int i=0; i<sub1.size(); i++)\n        {\n            for(int j=0; j<sub2.size(); j++)\n            {\n                if(sub1[i].size() == sub2[j].size())\n                {\n                    if(predicate(sub1[i], sub2[j]) == true)\n                    {\n                        count++;\n                    }\n                }\n            }\n        }\n        \n        return count;\n    }\n};\n```
['Backtracking', 'Recursion', 'C', 'C++']