[Python 3 🐍] DP - Recursive 12 LOC
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```\nclass Solution:\n    def stringCount(self, n: int) -> int:\n        \n        MOD = 10**9+7\n        \n        @cache\n        def dp(i,l,e,t):\n\n            if i == 0:\n                if l == 0 or e == 0 or e == 1 or t == 0:\n                    return 0\n                return 1\n\n            ans = 23*dp(i-1,l,e,t) % MOD\n\n            ans += dp(i-1,min(l+1,1),e,t)  % MOD\n\n            ans += dp(i-1,l,min(e+1,2),t)  % MOD\n\n            ans += dp(i-1,l,e,min(t+1,1))  % MOD\n\n            return ans\n        \n        return dp(n,0,0,0) % MOD\n```
['Python3']