#include<iostream>
using namespace std;
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstring>
# include <stdio.h>
#include<vector>
int arr[26];
void fun(char a)
{
int t = a - 'A';
arr[t]++;
}
int main()
{
string t;
for (int i = 0; i < 4; i++)
{
getline(cin, t);
for (int j = 0; j <t.size(); j++)
if (t[j] >= 'A' && t[j] <= 'Z')
fun(t[j]);
}
int max = arr[0];
for (int i = 0; i < 26; i++)
if (arr[i] > max)
max = arr[i];
for (int i = max; i > 0; i--)
{
for (int j = 0; j < 26; j++)
{
if (arr[j] < i)
cout << " ";
else
cout << "*";
cout << " ";
}
cout << "\n";
}
for (int i = 0; i < 52; i++)
cout << " ";
cout << "\n";
char ch = 'A';
for (int i = 1; i <= 52; i++)
{
if (i % 2 != 0)
{
cout << ch;
ch++;
}
else
cout << " ";
}
return 0;
}