#include<iostream>
#include<string>
using namespace std;
int book[28];string a;
int main()
{
while(cin>>a)
for(int i=0;i<a.size();i++)
book[a[i]-'A'+1]++;
int maxx=0;
for(int i=1;i<=26;i++) maxx=max(maxx,book[i]);
for(int i=maxx;i>=1;i--){
for(int j=1;j<=26;j++)
if(book[j]==i) {cout<<"*"<<" ";book[j]--;}
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";
return 0;
}