daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest May 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
Top