C++ || case distinction || O(1) || fast and clean code
Approach 1: case distinction\n\nWe are just looking at the different possible cases.\n\ncpp\n    static int countTime(const string& time) {\n        int ans = 1
### Approach 1: case distinction\n\nWe are just looking at the different possible cases.\n\n```cpp\n    static int countTime(const string& time) {\n        int ans = 1;\n        if (time[0] == \'?\') {\n            if (time[1] == \'?\') {\n                ans *= 24;\n            } else if (time[1] <= \'3\') {\n                ans *= 3;\n            } else {\n                ans *= 2;\n            }\n        } else if (time[1] == \'?\') {\n            ans *= time[0] < \'2\' ? 10 : 4;\n        }\n        if (time[3] == \'?\') ans *= 6;\n        if (time[4] == \'?\') ans *= 10;\n        return ans;\n    }\n```\n\n**Complexity Analysis**\n  * Time complexity: $$O(1)$$\n  * Space complexity: $$O(1)$$\n\n_As always: Feedback, questions, and comments are welcome. Leaving an upvote sparks  joy! :)_\n\n**p.s. Join us on the [LeetCode The Hard Way Discord Server](https://discord.gg/hFUyVyWy2E)!**
['C']