[c++][Easy understanding][split]
\nclass Solution {\npublic:\n    vector<string> charary;\n    bool isValidSerialization(string preorder) {\n       split(preorder);\n       int diff=1;\n       
```\nclass Solution {\npublic:\n    vector<string> charary;\n    bool isValidSerialization(string preorder) {\n       split(preorder);\n       int diff=1;\n       for(string pre: charary){\n           if(--diff<0) return false;\n           if(pre!="#") diff+=2;\n       }\n        return diff==0;\n    }\n    \n    void split(string s) {\n        stringstream ss(s);\n        string tok;\n        while (getline(ss, tok,\',\')) {\n            charary.push_back(tok);\n        }\n    }\n    \n};\n```\n**Feel free to ask any question in the comment section.**\nI hope that you\'ve found the solution useful.\nIn that case, **please do upvote and encourage me** to on my quest to document all leetcode problems\uD83D\uDE03\nHappy Coding :)\n
['C', 'C++']