simple java solution
\tpublic int countSubstrings(String s, String t) {\n\t\t\tint ans = 0;\n\t\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\t\tfor (int j = 0; j < t.length(); j+
\tpublic int countSubstrings(String s, String t) {\n\t\t\tint ans = 0;\n\t\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\t\tfor (int j = 0; j < t.length(); j++) {\n\t\t\t\t\tint diff = 0;\n\t\t\t\t\tint x = i;\n\t\t\t\t\tint y = j;\n\t\t\t\t\twhile (x<s.length() && y<t.length()){\n\t\t\t\t\t\tif(s.charAt(x)!=t.charAt(y)) diff++;\n\t\t\t\t\t\tif(diff == 1) ans++;\n\t\t\t\t\t\tif(diff==2) break;\n\t\t\t\t\t\tx++;\n\t\t\t\t\t\ty++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ans;\n\t\t}
['Java']