Just treat string as Number with redix of 26
I believe Idea should be workable, but not have time to complete.\n\nPlease help me to take a look what is the problem.\n\n\nclass Solution {\n    long mod = (l
I believe Idea should be workable, but not have time to complete.\n\nPlease help me to take a look what is the problem.\n\n```\nclass Solution {\n    long mod = (long) (Math.pow(10, 9) + 7);\n    public int findGoodStrings(int n, String s1, String s2, String evil) {\n        long base = 1, res = 0, e = 0,  ebase = 1;\n        int i = 0, j = 0, el = evil.length();\n        while(i < n) {\n            if (s1.charAt(i) != s2.charAt(i++)) break;\n        }\n        int idx = s1.indexOf(evil);\n        if (idx > 0 && idx + evil.length() - 1 <= i - 1) return 0;\n        int left = i - 1, br = 0;\n        for (i = n - 1, j = el - 1; i >= left; i--, j--) {\n            if (j >= 0) {\n                e += (ebase * (evil.charAt(j) - \'a\')) % mod;\n            } else {\n                ebase = (ebase * 26) % mod;\n            }\n            if (s2.charAt(i) - br - \'a\' >= s1.charAt(i) - \'a\') {\n                res += (s2.charAt(i) - s1.charAt(i) + 1) * base % mod;\n                res %= mod;\n                br = 0;\n            } else {\n                res += (26 + s2.charAt(i) - s1.charAt(i) + 1) * base % mod;\n                res %= mod;\n                br = 1;\n            }\n            if (j <= 0 && s1.substring(i, i + el).compareTo(evil) <= 0 && s2.substring(i, i + el).compareTo(evil) >= 0){\n                res = (mod + res - ebase) % mod;\n            }\n            base = base * 26 % mod;\n            System.out.println(res);\n        }\n        return (int) res;\n    }\n}\n```
[]