#!/afs/athena/contrib/perl/perl

%wordcount = ();

while (<>) {
    s/^\s+//;
    ($word, $count) = split (/\s+/, $_);
    $wordcount{$word} += $count;
}

sub byvalue {
    $wordcount{$b} <=> $wordcount{$a};
}

foreach $word (sort byvalue (keys (%wordcount))) {
    printf "%20s %d\n", $word, $wordcount{$word};
}
