#!/usr/bin/perl -w
################################################################
# count.pl : Letter count over the alphabet [A..Z]             #
#    Input from STDIN : Text                                   #
#    Output to STDOUT : list of pairs (letter, frequency)      #
#--------------------------------------------------------------#
# Transliteration of special characters according to English   #
#   rules                                                      #
# For special characters of other languages use preptext.pl    #
#   first.                                                     #
#--------------------------------------------------------------#
# Klaus Pommerening 1997-Sep-12, 1999-Oct-08                   #
#                                                              #
# This program is freeware. Use it as you like.                #
# Usual disclaimers apply.                                     #
################################################################

require "auxcrypt.pl";

$text = &gettext;                   # Get text as list
@textlist = split(//,$text);        #   of characters in A..Z.
for ($j = 0; $j < @alphabet; $j++) {
  $count{$alphabet[$j]} = 0;        # Initialize counters.
  }
foreach $i (@textlist) {            # Count letters.
  $count{$i}++;
  }
for ($j = 0; $j < @alphabet; $j++) {
  print "$alphabet[$j]: $count{$alphabet[$j]}\n";
  }
