Buggy python submission (verdict: Time Limit Exceeded):
S = input()
K = int(input())

ans = []
table ={}

for i in range(len(S)):
    for j in range(len(S)+1):
        if (j-i)>=6:
            break
        if i==j:
            s = S[i]
            if s in table:
                continue
            table[s] = 1
            ans.append(s)
            continue
        if S[i:j]=="":
            continue
        s = S[i:j]
        if s in table:
            continue
        table[s] = 1
        ans.append(s)

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


Fixed submission:
S = input()
K = int(input())

ans = []
table ={}

for i in range(len(S)):
    for j in range(6):
        if i==j:
            s = S[i]
            if s in table:
                continue
            table[s] = 1
            ans.append(s)
            continue
        if S[i:i+j]=="":
            continue
        s = S[i:i+j]
        if s in table:
            continue
        table[s] = 1
        ans.append(s)

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

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
K = int(input())

ans = []

for i in range(len(S)):
    for j in range(len(S)+1):
        if (j-i)>=6:
            break
        if i==j:
            ans.append(S[i])
            continue
        if S[i:j]=="":
            continue
        ans.append(S[i:j])
ans = sorted(list(set(ans)))
print(ans[K-1])

Fixed submission:
S = input()
K = int(input())

ans = []
table ={}

for i in range(len(S)):
    for j in range(6):
        if i==j:
            s = S[i]
            if s in table:
                continue
            table[s] = 1
            ans.append(s)
            continue
        if S[i:i+j]=="":
            continue
        s = S[i:i+j]
        if s in table:
            continue
        table[s] = 1
        ans.append(s)

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

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

ans = set()

for i in range(len(S)):
    for j in range(len(S)+1):
        if (j-i)>=5:
            break
        if i==j:
            ans.add(S[i])
            continue
        if S[i:j]=="":
            continue
        ans.add(S[i:j])
ans = sorted(list(ans))
print(ans[K-1])


Fixed submission:
S = input()
K = int(input())

ans = []
table ={}

for i in range(len(S)):
    for j in range(6):
        if i==j:
            s = S[i]
            if s in table:
                continue
            table[s] = 1
            ans.append(s)
            continue
        if S[i:i+j]=="":
            continue
        s = S[i:i+j]
        if s in table:
            continue
        table[s] = 1
        ans.append(s)

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

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
K = int(input())

ans = set()

for i in range(len(S)):
    for j in range(len(S)+1):
        if (j-i)>=6:
            break
        if i==j:
            ans.add(S[i])
            continue
        if S[i:j]=="":
            continue
        ans.add(S[i:j])
ans = sorted(list(ans))
print(ans[K-1])


Fixed submission:
S = input()
K = int(input())

ans = []
table ={}

for i in range(len(S)):
    for j in range(6):
        if i==j:
            s = S[i]
            if s in table:
                continue
            table[s] = 1
            ans.append(s)
            continue
        if S[i:i+j]=="":
            continue
        s = S[i:i+j]
        if s in table:
            continue
        table[s] = 1
        ans.append(s)

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

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
K = int(input())

ans = set()

for i in range(len(S)):
    for j in range(len(S)+1):
        if i==j:
            ans.add(S[i])
            continue
        if S[i:j]=="":
            continue
        ans.add(S[i:j])
ans = sorted(list(ans))
print(ans[K-1])


Fixed submission:
S = input()
K = int(input())

ans = []
table ={}

for i in range(len(S)):
    for j in range(6):
        if i==j:
            s = S[i]
            if s in table:
                continue
            table[s] = 1
            ans.append(s)
            continue
        if S[i:i+j]=="":
            continue
        s = S[i:i+j]
        if s in table:
            continue
        table[s] = 1
        ans.append(s)

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