Brute force but even it's not easier to think upon(a smarter brute force)
Intuition\nwe are going to do this problem with brute force since constraints are low\n\n# Approach\nthere are two main problems with brute force too \n1.the si
# Intuition\nwe are going to do this problem with brute force since constraints are low\n\n# Approach\nthere are two main problems with brute force too \n1.the size of sliding window while iterating all substring is not fixed so it will take a lot of lot of time complexity in order to math the strings\n\nsoln- this can be resolved by just taking eqial length of substrings and just compare them as unequal length substrings would never be same so why check for them (k is incremented equally on bith strings so thus maintaining eequal length)\n\n2. just one character should differ and thw rest of substring should come in same alignment as the other substring how do we keep track of this \n\nsoln- we keep checking each character from both substrings of equal length by moving both pointer after every check thus maintaining the alignment(k is incremented equally on both substrings )\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int countSubstrings(String s, String t) {\n        int ans =0;\n        for(int i=0;i<s.length();i++)\n        {\n            for(int j=0;j<t.length();j++)\n            {\n                int count =0;\n                for(int k=0;i+k<s.length()&&j+k<t.length();k++)\n                {\n                    if(s.charAt(i+k)!=t.charAt(j+k))\n                    {\n                        count++;\n                    }\n                    if(count==1)\n                     ans++;\n                }\n            }\n            \n        }\n        return ans;\n    }\n}\n```
['Java']