100% beats java solution
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: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\npublic class Solution {\n    private static final int M = 1000000007;\n\n    private int mul(long x, long y) {\n        return (int) (x * y % M);\n    }\n\n    private int add(int x, int y) {\n        x += y;\n        if (x >= M) {\n            x -= M;\n        }\n        return x;\n    }\n\n    public int stringCount(int n) {\n        int[][][] dp = new int[2][2][3];\n        dp[0][0][0] = 1;\n\n        for (int i = 0; i < n; ++i) {\n            int[][][] temp = new int[2][2][3];\n\n            for (int j = 0; j < 2; ++j) {\n                for (int k = 0; k < 2; ++k) {\n                    for (int h = 0; h < 3; ++h) {\n                        if (dp[j][k][h] == 0) continue;\n                        temp[j][k][h] = add(temp[j][k][h], mul(dp[j][k][h], 23));\n                        temp[1][k][h] = add(temp[1][k][h], dp[j][k][h]);\n                        temp[j][1][h] = add(temp[j][1][h], dp[j][k][h]);\n                        temp[j][k][Math.min(h + 1, 2)] = add(temp[j][k][Math.min(h + 1, 2)], dp[j][k][h]);\n                    }\n                }\n            }\n\n            dp = temp;\n        }\n\n        return dp[1][1][2];\n    }\n}\n\n```
['Java']