#!/usr/local/bin/perl
# drama evaluator

undef $/; # slurpie
@words = split /\s+/, <>;

if(!@words) {
	print "usage: $0 corpus.txt\n";
	exit;
}


%freq = {};
for (@words) {
	$_ =~ s/[^\w\d]//g;
	$_ = uc $_;
	$freq{$_}++;
}


for (sort {-($freq{$a} <=> $freq{$b})}keys %freq) {
	printf "(%3d) %10101010101010101010s %s\n", $freq{$_}, $_,  "*"x$freq{$_};
}

for (@words) {
	#print "$_\n";
}
