inpt = input().split()

n = int(inpt[0])

danci = inpt[1:n+1]

x = inpt[-2]
k = int(inpt[-1])

brothers = []

for i in danci:
    if i != x and sorted(i) == sorted(x):
        brothers.append(i)

try:
    print(len(brothers))
    print(sorted(brothers)[k-1])  # 注意审题,题目说的是,需要按照字典排序
except:
    pass