#include<bits/stdc++.h>
using namespace std;
int main()
{
char map[400][26];
for(int i=0;i<400;i++){
for(int j=0;j<26;j++){
map[i][j]=' ';
}
}
for(int i=0;i<26;i++) map[0][i]='A'+i;
string s;int max=0;int n[36];
for(int i=0;i<4;i++){
getline(cin,s);
for(int j=0;j<s.length();j++){
if(s[j]>='A'&&s[j]<='Z') {
n[s[j]-'A']++;
if(n[s[j]-'A']>max) max=n[s[j]-'A'];
}
}
}
for(int i=0;i<26;i++){
for(int j=1;j<=n[i];j++){
map[j][i]='*';
}
}
for(int i=max-1;i>=0;i--){
for(int j=0;j<26;j++){
cout<<map[i][j]<<" ";
}
cout<<endl;
}
return 0;
}