#include <bits/stdc++.h> using namespace std; const int N1 = 1e8 + 5; const int N2 = 1e2 + 5; int pos,len,t; char tree[N1]; char str[N2]; void create(int pos){ char c = str[t ++]; if(c == '#'){ return ; } tree[pos] = c; create(pos * 2); create(pos * 2 + 1); } void traverse(int root){ if(tree[root] == 0){ return; } traverse(2*root); cout << tree[root] << " "; traverse(2 * root + 1); } int main(){ while(scanf("%s",str) != EOF){ t = 0; create(1); traverse(1); cout << endl; } return 0; }