#include<iostream>
#include<cstdio>
#include<cstring>
#include <stdio.h>
using namespace std;
int nummber[26];
int main() {
int max = 0;
char s[81];
for (int i = 0; i < 4;i++) {
cin.getline(s, 256);
int lenth = strlen(s);
for (int j = 0; j < lenth; j++) {
if (s[j] >= 'A'&&s[j] <= 'Z')
nummber[s[j] - 'A']++;
}
}
for (int i = 0; i < 26; i++) {
if (nummber[i] >= max)
max = nummber[i];
}
for (int i = max; i>0 ; i--) {
for (int j =0; j <26; j++) {
if (i <=nummber[j])
cout << "* ";
else
cout << " ";
}
cout << endl;
}
for (int i = 0; i < 26; i++)
printf("%c", i + 'A');
}