//
//  Problem 2
//  by Pierre Grabolosa on 3/13/07 
//  Modified by William Kreahling 3/18/07.
//
import java.util.Scanner;

public class problem2 
{
   public static void main (String args[]) throws java.io.IOException {
   
   Scanner scanIn = new Scanner(System.in);

      System.out.println("Input to analyze:");
      String input = scanIn.nextLine();
      
      if (input.length() == 0)
         System.out.println("\nGoodbye");
      else 
      {
         // words count~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         int count = 1;
         boolean space = false;
         int freq[] = new int[26];
         
         for (int i = 0; i < 26; i++)
            freq[i] = 0;

         input = input.toUpperCase();
         for (int i = 0 ; i < input.length(); i++) 
         {
            if (input.charAt(i) == ' ' || input.charAt(i) == '\t')
            {
               if (! space)
                  count++;
               space = true;
            }
            else
            {
               space = false;
               if (input.charAt(i) >= 'A' && input.charAt(i) <= 'Z') 
                  freq[input.charAt(i) - 'A']++;
            }
         }
         System.out.println("\nInput is " + count + " words long.\n");
         
         // Print letter frequency ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         
         count = 0;
         for (int num : freq)
         {
            if (num > 0)
               System.out.println("" + (char)('A'+ count++) + " : " + num);
            else
               count++;
         }
      }
   }
}
