## 3 December 2014

### Problem:

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.

### Input Format:

newspaper content
Message content

YES/NO

None

### Sample Input

my favorite animals are Cat,Lion and Frog
i love to Code and Code

NO

### Explanations:

C appears only 1 times in Newspaper and 2 times in Message.

Solution:

chomp(\$h=<STDIN>);
\$h=~ s/ //g;
chomp(\$s=<STDIN>);
\$s=~ s/ //g;
@arr=split(//,\$s);
\$len=@arr;
foreach(\$i=0;\$i<\$len;\$i++)
{
if(\$h =~ /\$arr[\$i]/)
{
\$h=~ s/\$arr[\$i]//;
}
else
{
print "NO";
exit;
}
}
print "YES";

### Tips:

Exit the code as soon as 1st not matching condition is met.