[33 MS Java KMP + 2D DP] Just proud of myself for eventually getting this one without any hints :)
\nclass Solution {\n    final int MOD = (int) 1e9 + 7;\n    int[] T;\n    char[] a, b, e;\n    Integer[][][][] dp;\n    \n    public int findGoodStrings(int n, 
```\nclass Solution {\n    final int MOD = (int) 1e9 + 7;\n    int[] T;\n    char[] a, b, e;\n    Integer[][][][] dp;\n    \n    public int findGoodStrings(int n, String s1, String s2, String evil) {\n        if (s1.compareTo(s2) > 0) return 0;\n        int start = 0;\n        while (start < n && s1.charAt(start) == s2.charAt(start)) start++;\n        String equalPref = s1.substring(0, start);\n        if (equalPref.contains(evil)) return 0;\n        genTable(evil);\n        int startPref = 0, i;\n        for (i = 0; i < equalPref.length(); i++) {\n            if (equalPref.charAt(i) == evil.charAt(startPref)) startPref++;\n            else {\n                i--;\n                startPref = T[startPref];\n                if (startPref == -1) {\n                    startPref++;\n                    i++;\n                }\n            }\n        }\n        a = s1.toCharArray();\n        b = s2.toCharArray();\n        e = evil.toCharArray();\n        dp = new Integer[n][e.length][2][2];\n        return findRec(start, startPref, 1, 1);\n    }\n    \n    private int findRec(int i, int j, int blo, int bhi) {\n        if (j == e.length) return 0;\n        if (i == a.length) return 1;\n        if (dp[i][j][blo][bhi] != null) return dp[i][j][blo][bhi];\n        char lo = blo == 1 ? a[i] : \'a\';\n        char hi = bhi == 1? b[i] : \'z\';\n        long ret = 0;\n        for (char c = lo; c <= hi; c++) {\n            int j_prime = j;\n            while (j_prime >= 0 && c != e[j_prime]) j_prime = T[j_prime];\n            ret += findRec(i+1, ++j_prime, (blo == 1 && c == lo) ? 1 : 0, \n                           (bhi == 1 && c == hi) ? 1 : 0);\n        }\n        return dp[i][j][blo][bhi] = (int) (ret % MOD);\n    }\n    \n    private void genTable(String evil) {\n        int m = evil.length(), cand = 0, idx = 1;\n        char[] cs = evil.toCharArray();\n        T = new int[m];\n        T[0] = -1;\n        for (; idx < m; idx++) {\n            if (cs[idx] == cs[cand]) T[idx] = T[cand];\n            else {\n                T[idx] = cand;\n                while (cand >= 0 && cs[cand] != cs[idx]) cand = T[cand];\n            }\n            cand++;\n        }\n    }\n}\n```
[]