Solution in JAVA and C++
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nbrute force\n# Approach\n<!-- Describe your approach to solving the problem. -->\nchecking\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```cpp []\nclass Solution {\npublic:\n    int countTime(string t) {\n        int s=1;\n        if(t[4]==\'?\')\n        s*=10;\n        if(t[3]==\'?\')\n        s*=6;\n        if(t[0]==\'?\'&&t[1]==\'?\'){\n        s*=24;\n        return s;\n        }\n        if(t[0]==\'2\'&&t[1]==\'?\')\n        s*=4;\n        if((t[0]==\'1\'||t[0]==\'0\')&&t[1]==\'?\')\n        s*=10;\n        if((t[1])<\'4\'&&t[0]==\'?\')\n        s*=3;\n        if((t[1])>=\'4\'&&t[0]==\'?\')\n        s*=2;\n        return s;\n        \n\n        \n    }\n};\n```\n```java []\nclass Solution {\n    public int countTime(String t) {\n        int s=1;\n        if(t.charAt(4)==\'?\')\n        s*=10;\n        if(t.charAt(3)==\'?\')\n        s*=6;\n        if(t.charAt(0)==\'?\'&&t.charAt(1)==\'?\'){\n            s*=24;\n            return s;\n        }\n        if(t.charAt(0)==\'2\'&&t.charAt(1)==\'?\')\n        s+=4;\n        if((t.charAt(0)==\'1\'||t.charAt(0)==\'0\')&&t.charAt(1)==\'?\')\n        s*=10;\n        if(t.charAt(1)<\'4\'&&t.charAt(0)==\'?\')\n        s*=3;\n        if(t.charAt(1)>=\'4\'&&t.charAt(0)==\'?\')\n        s*=2;\n        return s;\n    }\n}\n```
['String', 'Enumeration', 'C++', 'Java']