def isaMatch(word, template):
	if len(word) != len(template):
		return False
	i = 0
	while i < len(word):
		if word[i] == template[i] or template[i] == '-':
			i += 1
		else:
			return False
	return True

#print isaMatch('hello', 'h-l--')
#print isaMatch('hello', 'h-l-a')
#print isaMatch('hello', 'hel--')	

f = open('crosswords.txt')
list = []
for line in f:
	word = line.strip()
	list.append(word)
#print list

def getMatches(aList, aWord):
	res = []
	for element in aList:
		if isaMatch(element, aWord):
			res.append(element)
	return res

word = raw_input('Type in a pattern word or a blank to quit > ')
while word != '':
	result = getMatches(list, word)
	print result
	word = raw_input('Type in a pattern word or a blank to quit > ')

	
