#include <iostream> using namespace std; struct TreeNode { char val; TreeNode* left; TreeNode* right; }; int i = 0; void create(string& s, TreeNode*& node) { if (i >= s.size() || s[i] == '#') { node = nullptr; i++; return; } else { node = new TreeNode; node->val = s[i++]; create(s, node->left); create(s, node->right); } } void infixOrder(TreeNode* node) { if(node == nullptr) return; infixOrder(node->left); cout << node->val << " "; infixOrder(node->right); } int main(void) { string s; cin >> s; TreeNode* root = nullptr; create(s, root); infixOrder(root); return 0; }