Simple java code 0 ms beats 100 %
\n# Complexity\n- \n\n# Code\n\nclass Solution {\n    public int countTime(String time) {\n        char arr[] = time.toCharArray();\n        int ans = 1;\n     
\n# Complexity\n- \n![image.png](https://assets.leetcode.com/users/images/63f00b15-a6a3-4fa5-b17f-190bd85ada1b_1706715198.2063537.png)\n# Code\n```\nclass Solution {\n    public int countTime(String time) {\n        char arr[] = time.toCharArray();\n        int ans = 1;\n        if (arr[4] == \'?\') {\n            ans = 10;\n        }\n        if (arr[3] == \'?\') {\n            ans = ans * 6;\n        }\n        if (arr[1] == \'?\') {\n            if (arr[0] == \'?\') {\n                ans = ans * 24;\n                arr[0] = \'1\';\n            } else if (arr[0] == \'2\') {\n                ans = ans * 4;\n            } else {\n                ans = ans * 10;\n            }\n        }\n        if (arr[0] == \'?\') {\n            if (arr[1] <= \'3\') {\n                ans = ans * 3;\n            } else {\n                ans = ans * 2;\n            }\n        }\n        return ans;\n    }\n}\n```
['String', 'Enumeration', 'Java']