749/757. Can I know where I did wrong please.
Can anyone please explain where I went wrong. Only 749/757 test cases passed.\n\n# Code\njava []\nclass Solution {\n    public long validSubstringCount(String w
Can anyone please explain where I went wrong. Only 749/757 test cases passed.\n\n# Code\n```java []\nclass Solution {\n    public long validSubstringCount(String word1, String word2) {\n        int left = 0, right = 0;\n        long ans = 0, temp = 0;\n        char[] w1 = word1.toCharArray();\n        char[] w2 = word2.toCharArray();\n        HashMap<Character, Integer> w1map = new HashMap<>();\n        HashMap<Character, Integer> w2map = new HashMap<>();\n        int match = 0;\n\n        for(char x: w2){\n            w2map.put(x, w2map.getOrDefault(x, 0)+1);\n        }\n\n        while(right < w1.length){\n            char curr = w1[right];\n            if (w2map.containsKey(curr)){\n                w1map.put(curr, w1map.getOrDefault(curr, 0)+1);\n                if (w1map.get(curr) == w2map.get(curr)) match++;\n            }\n            right++;\n            while (match == w2map.size()){\n                char a = w1[left];\n                if (w2map.containsKey(a)){\n                    if (w1map.get(a) == w2map.get(a)) match--;\n                    w1map.put(a, w1map.get(a)-1);\n                }\n                temp++;\n                left++;\n            }\n            ans += temp;\n        }\n\n        return ans;\n    }\n}\n```
['Java']