#!/usr/bin/perl

use warnings;
use strict;

$\ = $/;

$_ = <>, chomp;
my @sentences = map { s/^\s+|\s+$//gr } map { split m/[.]\K\s+(?=[A-Z0-9])/ } split m/[!?]\K/;

<>;

while(<>){
	chomp;
	m/\w/ or next;
	my( @words ) = m/\w+/g;
	my @found = @sentences;
	for my $word (@words){
		@found = grep m/\b$word\b/i, @found;
	}
	print "Search results for \"$_\":";
	print "- \"$_\"" for @found;
}