#include<bits/stdc++.h>
using namespace std;
int main(){
char a[402][28]={' '};
for(int i=0;i<=25;i++){
a[0][i]=65+i;
}
int l[26]={0};
string s;
for(int i=1;i<=4;i++){
getline(cin,s);
for(int j=0;j<s.size();j++){
if(s[j]>='A'&&s[j]<='Z'){
l[(s[j]-65)]++;
}
}
}
for(int i=0;i<26;i++){
for(int j=1;j<=l[i];j++){
a[j][i]='*';
}
}
sort(l,l+26);
int h=l[25];
for(int i=h;i>=0;i--){
for(int j=0;j<=25;j++){
cout<<a[i][j];
if(j<25){
cout<<" ";
}
}
if(i!=0) cout<<endl;
}
return 0;
}