my %hash; while () { chomp; $hash{$_} ++; print "$_$hash{$_}\n"; }