#include<iostream>
#include<cstring>
using namespace std;
string a1, a2, a3, a4;
char b[100][26];
int a[26];
int main() {
getline(cin, a1);
getline(cin, a2);
getline(cin, a3);
getline(cin, a4);
string c[4]={a1,a2,a3,a4};
for(int i=0;i<4;i++){
string t=c[i];
for(int j=0;j<t.length();j++) {
if(t[j]>='A' && t[j]<='Z') {
a[t[j]-'A']+=1;
}
}
}
int m=a[0];
for (int i=1;i<26;i++) {
if(a[i]>m) {
m=a[i];
}
}
for(int i=0;i<26;i++){
int t=a[i];
for(int j=m-1;j>=m-t;j--) {
b[j][i]='*';
}
for(int j=0;j<=m-t-1;j++) {
b[j][i]=' ';
}
}
for(int i=0;i<m;i++) {
for (int j=0;j<26;j++) {
cout<<b[i][j];
if(j!=25) {
cout<<" ";
}
}
if(i<25) {
cout<<endl;
}
}
cout<<"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
return 0;
}