#include <bits/stdc++.h>using namespace std;#define ElemType char
typedef struct BiTNode { ElemType data; struct BiTNode *left, *right;} BiTNode, *BiTree;
BiTree Create_Tree() {
BiTree T; char s; cin >> s;
if (s == '#') { T= NULL; }
else { T=new BiTNode; T->data=s; T->left = NULL; T->right = NULL; T->left=Create_Tree(); T->right=Create_Tree(); } return T;}
void preOrder(BiTree root) { if (root) { cout << root->data << ' '; preOrder(root->left); preOrder(root->right); }}
void inOrder(BiTree root) { if (root) { inOrder(root->left); cout << root->data << ' '; inOrder(root->right); }}
void postOrder(BiTree root) { if (root) { postOrder(root->left); postOrder(root->right); cout << root->data << ' '; }}
int main() { BiTree tree=Create_Tree(); cout << "先序:"; preOrder(tree); cout << "\n中序:"; inOrder(tree); cout << "\n后序:"; postOrder(tree); cout << endl; return 0;}
typedef struct BiTNode { ElemType data; struct BiTNode *left, *right;} BiTNode, *BiTree;
BiTree Create_Tree() {
BiTree T; char s; cin >> s;
if (s == '#') { T= NULL; }
else { T=new BiTNode; T->data=s; T->left = NULL; T->right = NULL; T->left=Create_Tree(); T->right=Create_Tree(); } return T;}
void preOrder(BiTree root) { if (root) { cout << root->data << ' '; preOrder(root->left); preOrder(root->right); }}
void inOrder(BiTree root) { if (root) { inOrder(root->left); cout << root->data << ' '; inOrder(root->right); }}
void postOrder(BiTree root) { if (root) { postOrder(root->left); postOrder(root->right); cout << root->data << ' '; }}
int main() { BiTree tree=Create_Tree(); cout << "先序:"; preOrder(tree); cout << "\n中序:"; inOrder(tree); cout << "\n后序:"; postOrder(tree); cout << endl; return 0;}