#include<bits/stdc++.h>
using namespace std;
int ax[80] = {0};
int tmp = 0;
signed main()
{
for(int i = 0 ; i < 4; i ++)
{
string a;
getline(cin,a);
for(int j = 0 ; j < a.length() ; j++)
{
if(a[j] - 'A' < 26)
{
ax[a[j] - 'A']++;
}
}
}
for(int i = 0 ; i < 26 ; i++)
{
tmp = max(tmp , ax[i]);
}
for(; tmp > 0 ; tmp--)
{
for(int j = 0 ; j < 26 ; j++)
{
if(ax[j] >= tmp&&j!=25) cout<<"* ";
else if(j!=25) cout<<" "<<" ";
else if(j==25&&ax[j] >= tmp) cout<<"*"<<endl;
else 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;
}```