while True:
try:
inn = input().split(' ')
s = sorted(inn[1:int(inn[0])+1])
target = inn[int(inn[0])+1]
th = int(inn[-1])
dict1 = {}
res = 0
list2 = []
for word in s:
string = ''.join(sorted(word))
if word not in dict1:
dict1[word] = [string,1]
else:
dict1[word][1] += 1
for key,value in dict1.items():
if key != target and value[0] == ''.join(sorted(target)):
res += value[1]
for _ in range(value[1]):
list2.append(key)
print(res)
print(list2[th-1])
except:
break


京公网安备 11010502036488号