Simple Intuitive DP Solution
\n# Code\n\nclass Solution {\npublic:\n    int mod = 1e9+7;\n    long long dp[100001][2][3][2];\n    int N;\n    long long f(int idx,int l,int e,int t){\n      
\n# Code\n```\nclass Solution {\npublic:\n    int mod = 1e9+7;\n    long long dp[100001][2][3][2];\n    int N;\n    long long f(int idx,int l,int e,int t){\n        if(dp[idx][l][e][t] != -1)return dp[idx][l][e][t];\n        if(idx == N){\n            if(l == 1 && e == 2 && t == 1){\n                return dp[idx][l][e][t] = 1;\n            }\n            return dp[idx][l][e][t] = 0;\n        }\n        long long ans = 0;\n        for(char c = \'a\';c<=\'z\';c++){\n            int nl = l;\n            int ne = e;\n            int nt = t;\n            if(c == \'l\'){\n                nl++;\n                if(nl > 1)nl = 1;\n            }\n            else if(c == \'t\'){\n                nt++;\n                if(nt > 1)nt = 1;\n            }\n            else if(c == \'e\'){\n                ne++;\n                if(ne > 2)ne = 2;\n            }\n            ans = (ans + f(idx+1,nl,ne,nt))%mod;\n        }\n        return dp[idx][l][e][t] = ans;\n    }\n    int stringCount(int n) {\n        memset(dp,-1,sizeof(dp));\n        N = n;\n        return f(0,0,0,0);\n    }\n};\n```
['Dynamic Programming', 'C++']