################################################################
# count.pl : Letter count over the alphabet [A..Z]             #
#    Input from STDIN : Text                                   #
#    Output to STDOUT : list of pairs (letter, frequency)      #
#--------------------------------------------------------------#
# Klaus Pommerening 12. September 1997, 8. Oktober 1999        #
#                                                              #
# 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";
  }
