#include <stdio.h>
#include <stdlib.h>
#include<string.h>
int f[26];
int find(int pos,int top)
{
while(f[pos] < top && pos<26)
pos++;
if(pos == 26)
return -1;
return pos;
}
int max(int a,int b)
{
if(a>b)
return a;
else
return b;
}
int main()
{
int top=0,i;
char ch;
memset(f,0,sizeof(f[0]));
while((ch = getchar()) != EOF)
{
if(ch >= 'A' && ch <= 'Z')
f[ch - 'A']++;
}
for(i=0;i<26;i++)
top=max(top,f[i]);
for(i=top;i >= 1; i--)
{
int pos=0,temp,j,flag=1;
while(1)//分段遍历f[26]数组
{
temp=find(pos,i);
if(temp == -1)
break;
if(flag == 1)
flag=0;
else
printf(" ");//在判断还有后续了之后才输出那个空格
for(j = pos;j < temp; j++)
{
printf(" ");
}
printf("*");
pos=temp+1;
}
printf("\n");
}
for(i=0;i<25;i++)
printf("%c ",'A'+i);
printf("%c",'Z');
return 0;
}