#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int a[30];
int main()
{
char s[105];
int l,m=-1;
for(int i=0;i<4;i++)
{
cin.getline(s,100);
l=strlen(s);
for(int j=0;j<l;j++)
{
if(s[j]>='A'&&s[j]<='Z')
{
a[s[j]+'0'-65]++;
}
}
}
for(int i=0;i<26;i++)
{
m=max(m,a[i]);
}
for(int i=m;i>0;i--)
{
for(int j=0;j<26;j++)
{
if(a[j]>=i)
{
cout<<"* ";
}
else
{
cout<<" ";
}
}
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;
}