#include<malloc.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<queue>
using namespace std;
int main()
{
char tree[10000];
char s[10][10000];
gets(tree);
int t=0;
int len=strlen(tree);
int cengshu=log(len)/log(2)+1;
for(int i=1;i<=cengshu;i++)
for(int j=0;j<pow(2,i-1);j++)
s[i][j]=tree[t++];
for(int i=1;i<=cengshu;i++)
{
int geshu=pow(2,i-1);
if(i%2==0) reverse(s[i],s[i]+geshu);
}
for(int i=1;i<=cengshu;i++)
{
for(int j=0;j<pow(2,i-1);j++)
{
if(s[i][j]!='#') printf("%c ",s[i][j]);
}
printf("\n");
}
}