<>;chomp,++$h{$_}for split$",<>;chomp,print$h{$_}+0,$"for split$",<>