10 line easy c++ solution
 bool isValidSerialization(string preorder) {\n            if(preorder.empty())return false;\n            int cnt=1,i=0;\n            while(i<preorder.size()){\
     bool isValidSerialization(string preorder) {\n            if(preorder.empty())return false;\n            int cnt=1,i=0;\n            while(i<preorder.size()){\n                if(preorder[i]=='#')cnt--;\n                else cnt++;\n                if(cnt==0)break;\n                while(i<preorder.size()&&preorder[i++]!=',');\n            }\n            return cnt==0&&i==preorder.size()-1;\n        }
['C++']