Java || Brute Force || T.C - O(n^3) S.C - O(1)
\n    public int countSubstrings(String s, String t) {\n        \n        int len1 = s.length(), len2 = t.length(), ans = 0;\n        for(int i = 0; i < len1; i
\n    public int countSubstrings(String s, String t) {\n        \n        int len1 = s.length(), len2 = t.length(), ans = 0;\n        for(int i = 0; i < len1; i++){\n            for(int j = 0; j < len2; j++){\n                int ptr1 = i, ptr2 = j, diff = 0;\n                while(ptr1 < len1 && ptr2 < len2){\n                    if(s.charAt(ptr1) != t.charAt(ptr2))\n                        diff++;\n                    if(diff == 1)\n                        ans++;\n                    else if(diff == 2)\n                        break;\n                    ptr1++;\n                    ptr2++;\n                }\n            }\n        }\n        return ans;\n    }
[]