S = input()
K = int(input())
A = set()
for i in range(len(S)):
    for j in range(1, min(K + 1, len(S) - i + 1)):
        A.add(S[i:i + j])
A = list(A)
A.sort()
print(A[K - 1])

2adf71a3acffbe1e35bbb2e0dad3bae25b47f0e0
<mask token>

<mask token>
for i in range(len(S)):
    for j in range(1, min(K + 1, len(S) - i + 1)):
        A.add(S[i:i + j])
<mask token>
A.sort()
print(A[K - 1])

S = input()
K = int(input())
A = set()
for i in range(len(S)):
    for j in range(1, min(K + 1, len(S) - i + 1)):
        A.add(S[i:i + j])
A = list(A)
A.sort()
print(A[K - 1])
