Why it fails?? what did i miss
int dp[501][51][26];\n    string a,b,c;\n    int mod=1e9+7;\n    //  mx are characters we can take\n    int solve(int idx,int Eidx,int& n,char mn,char mx,char c
int dp[501][51][26];\n    string a,b,c;\n    int mod=1e9+7;\n    //  mx are characters we can take\n    int solve(int idx,int Eidx,int& n,char mn,char mx,char curr,bool f1,bool f2)\n    {\n        if(Eidx==c.size())\n            return 0;\n        if(idx==n)\n            return 1;\n        \n        \n        if(curr==\'*\')\n        {\n        int ans=0;\n        for(char ch=mn;ch<=mx;ch++)\n        {  \n           ans=(ans+solve(idx+1,c[Eidx]==ch?Eidx+1:0,n,(ch==mn && f1)?a[idx+1]:\'a\',(ch==mx && f2)?b[idx+1]:\'z\',ch,f1 && (ch==mn),f2 && (ch==mx)))%mod; \n        }\n        \n           return ans; \n        }\n        \n        if(dp[idx][Eidx][curr-\'a\']!=-1)\n            return dp[idx][Eidx][curr-\'a\'];\n        \n        int ans=0;\n        for(char ch=mn;ch<=mx;ch++)\n        {  \n           ans=(ans+solve(idx+1,c[Eidx]==ch?Eidx+1:0,n,(ch==mn && f1)?a[idx+1]:\'a\',(ch==mx && f2)?b[idx+1]:\'z\',ch,f1 && (ch==mn),f2 && (ch==mx)))%mod; \n        }\n        \n           return dp[idx][Eidx][curr-\'a\']=ans;  \n    }\n    int findGoodStrings(int n, string s1, string s2, string evil) \n    {  \n        a=s1;\n        b=s2;\n        c=evil;\n        a.push_back(\'a\');\n        b.push_back(\'z\');\n        \n        memset(dp,-1,sizeof(dp));\n        return solve(0,0,n,a[0],b[0],\'*\',true,true)%mod;\n    }\n};
[]