#pragma warning(disable:4996)
#include <stdio.h>
int main()
{
int count[26] = { 0 }, max = 0, i = 0, j = 0, last = 0;
char tmp = 0;
for (i = 0; i < 4; )
{
tmp = getchar();
if (tmp >= 'A' && tmp <= 'Z')
{
count[tmp - 'A']++;
if (count[tmp - 'A'] > max)
{
max = count[tmp - 'A'];
last = tmp - 'A';
}
}
else if (tmp == '\n')
{
i++;
}
}
for (i = max; i >= 1; i--)
{
for (j = last; j < 26; j++)
{
if (count[j] >= i)
{
last = j;
}
}
for (j = 0; j < last; j++)
{
if (count[j] >= i)
{
printf("* ");
}
else
{
printf(" ");
}
}
printf("*\n");
}
printf("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\n");
return 0;
}