JAVA solution
\nclass Solution {\n    public int countSubstrings(String s, String t) {\n        int ans = 0;\n        for(int i=0;i<s.length();i++){\n            for(int j=0;
```\nclass Solution {\n    public int countSubstrings(String s, String t) {\n        int ans = 0;\n        for(int i=0;i<s.length();i++){\n            for(int j=0;j<t.length();j++){\n                int x=i;\n                int y=j;\n                int d=0;\n                while(x<s.length()&&y<t.length()){\n                    if(s.charAt(x)!=t.charAt(y)){\n                        d++;\n                    }\n                    if(d==1){\n                        ans++;\n                    }\n                    if(d==2){\n                        break;\n                    }\n                    x++;\n                    y++;\n                }\n            }\n        }\n        return ans;\n    }\n}\n```
[]