//----------------------------------------------------------------------
// Input a tree string in S-expression, construct the tree and
// return the pointer to its root node.
//----------------------------------------------------------------------
virtual Node* constructTree(Node *root, std::string treeStr)const;
//----------------------------------------------------------------------
// Delete and release the memory allocation of each node, and
// return a nullptr.
//----------------------------------------------------------------------
virtual Node* deleteTree(Node *root)const;
//----------------------------------------------------------------------
// Return the height of the tree.
//----------------------------------------------------------------------
virtual int treeHeight(const Node *root)const;
//----------------------------------------------------------------------
// Return the sum of node weights.
//----------------------------------------------------------------------
virtual int treeWeight(const Node *root)const;
//----------------------------------------------------------------------
// Return the number of leaf nodes.
//----------------------------------------------------------------------
virtual int leafNum(const Node *root)const;
//----------------------------------------------------------------------
// Return the max path weight from root to leaf.
//----------------------------------------------------------------------
virtual int maxPathWeight(const Node *root)const;
There are many binary trees in the input. Each tree occupies a line, and is expressed in S-expression.
For each tree, output treeHeight, treeWeight, leafNum, maxPathWeight in a line.