#include <iostream>
#include <string>
#include <list>
using namespace std;

#define debug()

typedef list<string> List;
void processCase(string& s);

int main()
{
	string s;
	getline(cin, s);
	// test of what getline does.
	debug(	cout << "before" << endl;
		cout << s;
		cout << "after" << endl);
	while (s != "EndOfInput") { processCase(s); }
}
void readList(string& s, List& L);
void readText(string s);

void processCase(string& s) 
// s is first line of the case, rest is on cin.
{
	List L;
	readList(s, L);
	readTextSentences(s, T);
	/*
	for line k in T
	  for alphanum in line k
	    if alphanum in L squirlify sentence, break
	    */
	getline(cin, s);
	s = "EndOfInput"; // stop after one case for now.
}

void readList(string& s, List& L)
// get list of words starting with s, continuing on cin, terminated by EndOfList
{
	if (s != "EndOfList") 
	{
		L.push_back(s);
		getline(cin, s);
		debug(cout << "[" << s << "]" << endl);
		readList(s, L);
	}
}

void readText(string& s, List& Sentences);
// read text into L as sentences (with embedded endlines)
