S = eval(input())

N = len(S)

K = int(eval(input()))

ans = set()

for i in range(N):

    for j in range(i + 1, i + K + 1):

        ans.add(S[i:j])

print((sorted(list(ans))[K - 1]))

S = eval(input())

N = len(S)

K = int(eval(input()))



ans = set()

for i in range(1, K + 1):

    for j in range(N - i + 1):

        ans.add(S[j : j + i])

print((sorted(ans)[K - 1]))

S = eval(input())
N = len(S)
K = int(eval(input()))
ans = set()
for i in range(N):
    for j in range(i + 1, i + K + 1):
        ans.add(S[i:j])
print((sorted(list(ans))[K - 1]))

S = eval(input())
N = len(S)
K = int(eval(input()))
ans = set()
for i in range(1, K + 1):
    for j in range(N - i + 1):
        ans.add(S[j : j + i])
print((sorted(ans)[K - 1]))

-for i in range(N): -    for j in range(i + 1, i + K + 1): -        ans.add(S[i:j]) -print((sorted(list(ans))[K - 1])) +for i in range(1, K + 1): +    for j in range(N - i + 1): +        ans.add(S[j : j + i]) +print((sorted(ans)[K - 1]))