#include<stdio.h>
#include<stdlib.h>
char str[105];
struct BTNode{
char c;
struct BTNode* left;
struct BTNode* right;
};
struct BTNode* Create(int* pi)
{
if(str[*pi]=='#')
{
(*pi)++;
return NULL;
}
struct BTNode* root=(struct BTNode*)malloc(sizeof(struct BTNode));
root->c=str[(*pi)++];
root->left=Create(pi);
root->right=Create(pi);
return root;
}
void Inorder(struct BTNode* root)
{
if(root==NULL)
return;
Inorder(root->left);
printf("%c ",root->c);
Inorder(root->right);
}
int main()
{
scanf("%s",str);
int i=0;
struct BTNode* root=Create(&i);
Inorder(root);
return 0;
}