100%solution C++ { without hash}
\nIn this question you might think to just generate all the substring of both the arrays and then compare \neach one of them for exactly one different character
``` \nIn this question you might think to just generate all the substring of both the arrays and then compare \neach one of them for exactly one different character .. \nthis solution can be easily optimised .. \nyou can think that do we really need to generate all the substring and store them in some hash and then compare\n\nyou can easily apply two pointer\'s like approach and optimise the algo..\n\n\nsuppose string s="aba"\nand        string t="baba"\n\n\nkeep i pointer on s and iterate through all j in t and check for exact difference of one \ncontinue the loop until you reach the length or get difference more than one \n\n```\n\n\nclass Solution {\npublic:\n    int countSubstrings(string s, string t) {\n        int lens=s.length();\n        int lent=t.length();\n        \n        int ans=0;\n       \n        for(int I=0;I<lens;I++){\n            \n            for(int J=0;J<lent;J++){\n                int i=I;\n                int j=J;\n                int diff=0;\n                while(i<lens and j<lent and diff<=1){\n                    if(s[i]!=t[j])\n                        diff++;\n                    if(diff==1)\n                        ans++;\n                    i++;\n                    j++;\n                }\n            }\n        }\n        \n        return ans;\n    }\n};
[]