#include #include using namespace std;
struct TreeNode{ char data; TreeNode *leftchild; TreeNode *rightchild; TreeNode(char c):data(c),leftchild(NULL),rightchild(NULL){}
};
void visit(TreeNode *t){ //cout<data<<endl; printf("%c ",t->data); }
void PreOrder(TreeNode *root){ if(root==NULL)return; visit(root); PreOrder(root->leftchild); PreOrder(root->rightchild); }
void InOrder(TreeNode *root){ if(root==NULL)return; InOrder(root->leftchild); visit(root); InOrder(root->rightchild); return; }
void PostOrder(TreeNode *root){ if(root==NULL)return; PostOrder(root->leftchild); visit(root); PostOrder(root->rightchild); return; }
void LeverOrder(TreeNode root){ queue<TreeNode>q; if(root!=NULL){ q.push(root); } while(!q.empty()){ TreeNode *current=q.front(); q.pop(); visit(current); if(current->leftchild)q.push(current->leftchild); if(current->rightchild)q.push(current->rightchild); } return ; }
//int pos=0; TreeNode *build(string s,int &pos){ //cout<<pos<<endl; char c=s[pos++]; if (c=='#')return NULL; TreeNode *root=new TreeNode(c); root->leftchild=build(s,pos); root->rightchild=build(s,pos); return root; }
int main() { string line; cin>>line; int pos=0; TreeNode *root=build(line,pos); InOrder(root); return 0; }