#include<iostream>
#include <string>
using namespace std;
int main()
{
int n, h, le, flag, i, j, len;
string str;
flag = 1;
while ( cin >> n)
{
h = n * 2 + 3;
le = n + 2;
cin >> str;
if( flag != 1)
{
cout<<endl;
}
flag = 0;
len = str.size();
for(i = 1; i <= h; i++)
{
for(j = 0;j < len; j++)
{
if(((str[j]=='L' && j==len-1) && i!=h) || ((str[j]=='2' && i>(h+1)/2 && i<h) && j==len-1))
{
cout << "*";
}
else if(((str[j]!='J' ||str[j]!='L' ) &&i==1) || (i==h) || ((str[j]=='2' || str[j]=='9') && i==(h+1)/2))
{
cout<< string(le,'*');
}
else if((str[j]=='L' && i!=h &&j!=len-1) || (str[j]=='2' && i>(h+1)/2 && i<h))
{
cout<< '*' + string(le-1,' ');
}
else if((str[j]=='J' && i!=h) || (str[j]=='2' && i>1 && i<(h+1)/2) || (str[j]=='9' && i>(h+1)/2 && i<h))
{
cout<< string(le-1,' ') + '*';
}
else
{
cout<<'*'+string(le-2,' ')+'*';
}
if(j<len-1)
{
cout << " ";
}
}
cout << endl;
}
}
return 0;
}
#include <string>
using namespace std;
int main()
{
int n, h, le, flag, i, j, len;
string str;
flag = 1;
while ( cin >> n)
{
h = n * 2 + 3;
le = n + 2;
cin >> str;
if( flag != 1)
{
cout<<endl;
}
flag = 0;
len = str.size();
for(i = 1; i <= h; i++)
{
for(j = 0;j < len; j++)
{
if(((str[j]=='L' && j==len-1) && i!=h) || ((str[j]=='2' && i>(h+1)/2 && i<h) && j==len-1))
{
cout << "*";
}
else if(((str[j]!='J' ||str[j]!='L' ) &&i==1) || (i==h) || ((str[j]=='2' || str[j]=='9') && i==(h+1)/2))
{
cout<< string(le,'*');
}
else if((str[j]=='L' && i!=h &&j!=len-1) || (str[j]=='2' && i>(h+1)/2 && i<h))
{
cout<< '*' + string(le-1,' ');
}
else if((str[j]=='J' && i!=h) || (str[j]=='2' && i>1 && i<(h+1)/2) || (str[j]=='9' && i>(h+1)/2 && i<h))
{
cout<< string(le-1,' ') + '*';
}
else
{
cout<<'*'+string(le-2,' ')+'*';
}
if(j<len-1)
{
cout << " ";
}
}
cout << endl;
}
}
return 0;
}