#include <iostream>
using namespace std;

string s;
int k = 0;
void dfs(){
    if(s[k] == '#'){
        k ++;
        return;
    } 
    char root = s[k ++];
    dfs();
    cout<<root<<' ';
    dfs();
}
int main(){
    while(cin>>s){
        dfs();
        cout<<endl;
    }
    return 0;
}

好难 啊啊啊啊