Buggy python submission (verdict: Runtime Error):
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()
   if len(ans)>K:
    if cut_s==s[K]:
      ans.pop()
      break;
    ans.pop()
 
answer=ans[K-1]
print(answer)

Fixed submission:
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   if cut_s==ans[K]:
     ans.pop()
     break;
   ans.pop()
 
answer=ans[K-1]
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)-1):
 for j in range(i+2):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()
  if len(ans)>K:
    ans.pop()
 
answer=ans[K-1]
print(answer)

Fixed submission:
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   if cut_s==ans[K]:
     ans.pop()
     break;
   ans.pop()
 
answer=ans[K-1]
print(answer)

Buggy python submission (verdict: Runtime Error):
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()
  if len(ans)>K:
    ans.pop()
 
answer=ans[K-1]
print(answer)

Fixed submission:
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   if cut_s==ans[K]:
     ans.pop()
     break;
   ans.pop()
 
answer=ans[K-1]
print(answer)

Buggy python submission (verdict: Runtime Error):
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()
 
answer=ans[K-1]
print(answer)

Fixed submission:
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   if cut_s==ans[K]:
     ans.pop()
     break;
   ans.pop()
 
answer=ans[K-1]
print(answer)

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

ans=[]
ans.append(s)


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()

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

Fixed submission:
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   if cut_s==ans[K]:
     ans.pop()
     break;
   ans.pop()
 
answer=ans[K-1]
print(answer)

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

ans=[]
ans.append(s)


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   ans.pop()
  print(ans)
    


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

Fixed submission:
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   if cut_s==ans[K]:
     ans.pop()
     break;
   ans.pop()
 
answer=ans[K-1]
print(answer)

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

ans=[]
ans.append(s)
si=[]
count=0


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
   ans.sort()
   if len(ans)>K:
    ans.pop()

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

Fixed submission:
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   if cut_s==ans[K]:
     ans.pop()
     break;
   ans.pop()
 
answer=ans[K-1]
print(answer)

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

ans=[]
ans.append(s)
count=0


for i in range(len(s)-1):
 for j in range(i+1):
  cut_s=s[j:j+len(s)-i-1]
  if cut_s not in ans:
   ans.append(cut_s)
    
ans.sort()

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

Fixed submission:
s=input()
K=int(input())
 
ans=[]
ans.append(s)
 
 
for i in range(len(s)):
 for j in range(len(s)-i):
  cut_s=s[i:i+j+1]
  ans.append(cut_s)
  ans=sorted(set(ans))
  if len(ans)>K:
   if cut_s==ans[K]:
     ans.pop()
     break;
   ans.pop()
 
answer=ans[K-1]
print(answer)