/*
* 二叉树
*/
typedef struct node1{
char data;
struct node1 *lchild, *rchild;
}Bitree;
Bitree *Q[0];
Bitree *creatree(){
char ch;
int front, rear;
Bitree *T, *s;
T = NULL;
front = 1; rear = 0;
ch = getchar();
while(ch != '#'){
s = NULL;
if(ch != '@'){
s = (Bitree *)malloc(sizeof(Bitree));
s->data = ch;
s->lchild = s->rchild = NULL;
}
rear++;
Q[rear] = s;
if(rear==1) T = s;
else{
if(s != NULL && Q[front] != NULL){
if(rear%2==0) Q[front]->lchild = s;
else Q[front]->rchild = s;
}
if(rear%2==1) front++;
}
ch = getchar();
}
return T;
}
void Preorder(Bitree *T){
if(T){
printf("%4c", T->data);
Preorder(T->lchild);
Preorder(T->rchild);
}
}