#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int N = 110;
typedef struct TNode {
    char data;
    struct TNode* lchild;
    struct TNode* rchild;
}TNode,*Tree;
string str;
Tree Build(int &position){
    char c = str[position++];
    if(c=='#'){
        return NULL;
    }
    Tree root=(Tree)malloc(sizeof(TNode));
    root->data=c;
    root->lchild = Build(position);
    root->rchild=Build(position);


    return root;
}

void InOrder(Tree root){
    if(root == NULL) return;
    InOrder(root->lchild);
    printf("%c ",root->data);
    InOrder(root->rchild);

}
int main() {
    cin >> str;
    int position = 0;
    Tree root= Build(position);
    InOrder(root);

}
// 64 位输出请用 printf("%lld")