while True:
try:
line = str(input()).split(" ")
num_word = int(line[0])
word_list=[]
for i in range(num_word):
word_list.append(line[i+1])
word_search = line[-2]
kth = int(line[-1])
brother_list=[]
length = len(word_search) #搜索单词的长度
for word in word_list:
if len(word) == length and word != word_search:
check = True
for character in word:
if word.count(character)!= word_search.count(character):
check = False
break
if check == True:
brother_list.append(word)
brother_list.sort()
print(len(brother_list))
if kth <=len(brother_list):
print(brother_list[kth-1])
except:
break