#include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
typedef struct tree *Tree;
struct tree{
Tree lc;
Tree rc;
char data;
};
void CreatTree(Tree T)
{
char ch;
cin>>ch;
if(ch!='#') return ;
else
{
T=(Tree) malloc(sizeof(struct tree));
T->data=ch;
T->lc=T->rc=NULL;
CreatTree(T->lc);
CreatTree(T->rc);
}
}
void printf(Tree T)
{
while(T!=NULL)
{
cout<<T->data;
printf(T->lc);
printf(T->rc);
}
}
int main()
{
Tree T=NULL;
CreatTree(T);
printf(T);
return 0;
}
#include<cstdlib>
#include<iostream>
using namespace std;
typedef struct tree *Tree;
struct tree{
Tree lc;
Tree rc;
char data;
};
void CreatTree(Tree T)
{
char ch;
cin>>ch;
if(ch!='#') return ;
else
{
T=(Tree) malloc(sizeof(struct tree));
T->data=ch;
T->lc=T->rc=NULL;
CreatTree(T->lc);
CreatTree(T->rc);
}
}
void printf(Tree T)
{
while(T!=NULL)
{
cout<<T->data;
printf(T->lc);
printf(T->rc);
}
}
int main()
{
Tree T=NULL;
CreatTree(T);
printf(T);
return 0;
}