Java Solution
\tclass Solution {\n    public int countSubstrings(String s, String t) {\n        int m = s.length();\n        int n = t.length();\n        int res = 0;\n      
\tclass Solution {\n    public int countSubstrings(String s, String t) {\n        int m = s.length();\n        int n = t.length();\n        int res = 0;\n        for(int i = 0; i < m; i++)\n        {\n            for(int j = 0; j < n; j++)\n            {\n                int diff = 0;\n                for(int k = i, l = j; k < m && l < n; k++, l++)\n                {\n                    if(s.charAt(k) != t.charAt(l))\n                    {\n                        if(diff > 0)\n                        {\n                            break;\n                        }\n                        \n                        res++;\n                        diff++;\n                    }\n                    else if(diff == 1)\n                    {\n                        res++;\n                    }\n                }\n            }\n        }\n        \n        return res;\n    }\n\t}
[]