Simple DP
\n\n# Complexity\n- Time complexity:O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(n)\n Add your space complexity here, e.g. O(n) \n\n
\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n#define ll long long\nclass Solution {\npublic:\n    int mod = 1e9 + 7;\n    ll dp[100001][2][3][2];\n    ll solve(int n, int lc, int ec, int tc) {\n        if (n == 0) {\n            return (lc ==0 &&ec == 0 && tc == 0);\n        }\n        if (dp[n][lc][ec][tc] != -1)\n            return dp[n][lc][ec][tc];\n        return dp[n][lc][ec][tc] =\n                   (solve(n - 1, max(lc - 1, 0), ec, tc) % mod +\n                    solve(n - 1, lc, max(ec - 1, 0), tc) % mod +\n                    solve(n - 1, lc, ec, max(tc - 1, 0)) % mod +\n                    23 * solve(n - 1, lc, ec, tc) % mod) %\n                   mod;\n    }\n    int stringCount(int n) {\n        memset(dp, -1, sizeof(dp));\n        return solve(n, 1, 2, 1);\n    }\n};\n```
['Dynamic Programming', 'C++']