my $letter_A = <>; my $letter_B =<>; chomp ($letter_A, $letter_B); my @letter_A = split(//, $letter_A); my $count_A = 0; my $count_same = 0; for my $character(@letter_A){ $count_A++; if ($letter_B =~ /$character/){ $count_same++ } } if($count_A == $count_same){ print "YES\n"; }else{ print "NO\n"; }