#include<bits/stdc++.h>
using namespace std;
char a[1000];
long long n,A[26],k=-1;
int main(){
for(int i=1;i<=4;i++){
gets(a);
n=strlen(a);
for(int j=1;j<=n;j++){
if(a[j]>='A'&&a[j]<='Z'){
A[a[j]-'A']++;
if(A[a[j]-'A']>k) k=A[a[j]-'A'];
}
}
}
n=k;
for(int i=1;i<=n;i++){
for(int j=0;j<=25;j++){
if(k<=A[j]) cout<<'*';
else cout<<" ";
cout<<' ';
}
k--;
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";
}