Simple solution in JAVA.
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\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```java []\nclass Solution {\n    int M = (int)1e9+7;\n    public int findGoodStrings(int n, String s1, String s2, String evil) {\n        int[][] where = new int[evil.length()][26];\n        for (int i=0 ; i<evil.length() ; i++){\n            String s = evil.substring(evil.length()-i);\n            for (int j = 0; j < 26; j++){ \n                String ns = "" + (char)(j+\'a\') + s;\n                for (int k = ns.length(); k >= 0; k--)\n                    if (evil.endsWith(ns.substring(0, k))){\n                        where[i][j] = k;\n                        break;\n                    }    \n            }\n        }\n        int ans = solve(s2, evil, where) - solve(s1, evil, where) + M;\n        return ans%M + (s2.contains(evil)? 0 : 1);\n    }\n\tprivate int solve(String s, String evil, int[][] where){\n        int[][][] dp = new int[s.length()+1][evil.length()+1][2]; \n        dp[s.length()][0][1]=1;\n        for (int i=(s.length()-1) ; i>=0 ; i--){\n            for (int j=0 ; j<(evil.length()) ; j++)\n                for (int k=0 ; k<26 ; k++)\n                    for (int c=0 ; c<2 ; c++){\n                        int nc = c;\n                        if (k<(s.charAt(i) - \'a\'))\n                            nc = 0;\n                        else if (k>(s.charAt(i) - \'a\'))\n                            nc = 1;\n                        dp[i][where[j][k]][nc] += dp[i+1][j][c];\n                        dp[i][where[j][k]][nc] %= M;\n                    }   \n        }\n        int ans = 0;\n        for (int i=0 ; i<evil.length() ; i++){\n            ans += dp[0][i][0];\n            ans %= M;\n        }\n        return ans;\n    }\n}\n```
['Java']