while(<>) {
  foreach $word (split) {
    $score{$word}++;
  }
}

delete $score{""};

foreach $word (sort keys %score) {
  print "$word $score{$word}\n";
}
