Beats 100% C++ Code
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n     bool isValidSerialization(string pre) {\n        \n        int vac=1;\n        for(int i=0;i<pre.size();i++)\n        {\n            if(pre[i]==\',\')\n                continue;\n            \n           vac--;\n             while(i<pre.size() && pre[i]>=\'0\'&&pre[i]<=\'9\'&&pre[i]!=\',\')i++;\n            if(vac<0)\n                return false;\n           \n            if(pre[i]!=\'#\')\n                vac+=2;\n        }\n        if(vac)\n            return false;\n        return true;\n    }\n};\n```
['C++']