// Arup Guha
// 8/26/2022
// Transcribed printfreq.c to Java for CIS 3362

// Sample Program that reads in a string and prints out a
// bar graph of its letter frequencies.

// Used to illustrate the idea of looking for a cyclic shift to match
// regular letter frequencies for shift cipher cryptanalysis.

import java.util.*;

public class printfreq {

	public static void main(String[] args) {

		// Java sets frequencies to 0.
		int i, j, max=0;
		int[] freq = new int[26];

		// Read in one string.
		Scanner stdin = new Scanner(System.in);
		char[] cipher = stdin.next().toCharArray();
		

		// Go through it, looking at alphabetic characters only.
		for (i=0; i<cipher.length; i++) {
			char ch = Character.toLowerCase(cipher[i]);

			// Count it appropriately, 'a' is ascii offset.
			if (Character.isLetter(ch))
				freq[ch-'a']++;

			// This is just for the bar graph!
			max = Math.max(max, freq[ch-'a']);
		}

		// Print from top row to bottom row, going backwards in frequency.
		for (i=max; i>0; i--) {

			// Must go through each letter.
			for (j=0; j<26; j++) {

				// If the frequency is high enough, we print a star on this row.
				if (freq[j] >= i)
					System.out.printf("*  ");

				// Otherwise, a space...
				else
					System.out.printf("   ");
			}

			// Go to the next line.
			System.out.printf("\n");
		}

		// Letter headers for bar graph.
		for(i=0; i<26; i++)
			System.out.printf("%c  ", 'a'+i);
		System.out.println();
	}
}