C++ | DP | Recursion + Memoization
\n# Code\n\nclass Solution {\npublic: \n    long long dp[100005][3][2][2];\n    int mod = 1e9+7;\n    long long solve(int idx,int e,int l,int t,int n)\n    {\n 
\n# Code\n```\nclass Solution {\npublic: \n    long long dp[100005][3][2][2];\n    int mod = 1e9+7;\n    long long solve(int idx,int e,int l,int t,int n)\n    {\n        if(idx==n)\n        {\n            if(e>=2 && l>=1 && t>=1)\n            return 1;\n            return 0;\n        }\n        if(dp[idx][e][l][t]!=-1)\n        return dp[idx][e][l][t];\n        long long ans = 0;\n        for(int i=0;i<26;i++)\n        {\n            if(i==4 && e<2)\n            ans=(ans+solve(idx+1,e+1,l,t,n))%mod;\n            else if(i==11 && l<1)\n            ans=(ans+solve(idx+1,e,l+1,t,n))%mod;\n            else if(i==19 && t<1)\n            ans=(ans+solve(idx+1,e,l,t+1,n))%mod;\n            else\n            ans=(ans+solve(idx+1,e,l,t,n))%mod;\n        }\n        return dp[idx][e][l][t] = ans;\n    }\n    int stringCount(int n) {\n        memset(dp,-1,sizeof(dp));\n        return solve(0,0,0,0,n);\n    }\n};\n```
['Dynamic Programming', 'C++']