Advertisement
Guest User

Untitled

a guest
May 19th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.33 KB | None | 0 0
  1. my ($L, $D, $N) = split ' ', scalar <>;
  2.  
  3. my @words;
  4. for (1 .. $D) {
  5.     chomp(my $word = <>);
  6.     push @words, $word;
  7. }
  8.  
  9. for my $case (1 .. $N) {
  10.     chomp(my $pattern = <>);
  11.     $pattern =~ tr/()/[]/;
  12.     my $num_matches = 0;
  13.     foreach (@words) { $num_matches++ if /$pattern/ }
  14.     print "Case #$case: $num_matches\n";
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement