#include<bits/stdc++.h>
using namespace std;
string s;
int let[27],maxx;
int main()
{
for(int i=1; i<=4; i++){
getline(cin,s);
for(int j=0; j<s.length(); j++){
if(s[i]>='A' && s[i]<='Z') let[s[i]-'A'+1]++;
}
}
for(int i=1; i<=26; i++){
if(let[i]>maxx) maxx=let[i];
}
for(int i=maxx; i>=1; i--){
for(int j=1; j<=26; j++){
if(let[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";
}