Sarita have a newspaper cutting. She wants to make a new message by cutting alphabets from newspaper and paste them on a board. For spaces, she may just leave some space in her board, no need to cut from newspaper. She should take care of Uppercase and Lowercase. Obviously an alphabet taken from newspaper once could not be used again. Given content of newspaper cutting and message, print "YES" or "NO" whether message can be written from newspaper cutting.
my favorite animals are Cat,Lion and Frog
i love to Code and Code
Explanations:C appears only 1 times in Newspaper and 2 times in Message.
$h=~ s/ //g;
$s=~ s/ //g;
if($h =~ /$arr[$i]/)
Exit the code as soon as 1st not matching condition is met.