include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
struct BinNode{
char data;
BinNode left;
BinNode right;
//构造函数
BinNode(char val):data(val),left(nullptr),right(nullptr){}
};
BinNode build (string s,int &i){
if(s[i]==’#’){i;return NULL;}
BinNode* x=new BinNode(s[i]);
i;
x->left=build(s,i);
x->right=build(s,i);
return x;
}
void inorder(BinNode& x){
if(!x)return;
inorder(x->left);
cout<[HTML_REMOVED]data<<’ ‘;
inorder(x->right);
}
int main(){
string s;
cin>>s;
int i=0;
BinNode*_root=build(s,i);
inorder(_root);
return 0;
}