Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  s=S()
  k=I()

  _s=sorted(s)

  l=[]

  for i in range(3):
    for j in range(len(s)):
      if len(s)>i and _s[i]==s[j]:
        l.append(s[j])

        l.append(s[j:j+1])

        l.append(s[j:j+2])

        l.append(s[j:j+3])

        l.append(s[j:j+4])

        l.append(s[j:j+5])

  l=list(set(l))
  l.sort()

  return l[k-1]

print(main())


Fixed submission:
# a〜z
l=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

s=list(input())
K=int(input())

l2=[]

a=''
for x in l:
  if x in s:
    a=x
    for i in range(len(s)):
      if s[i]==a:
        for j in range(6):
          l2.append(''.join(s[i:i+j]))

l2=list(set(l2))
l2.remove('')
l2.sort()
print(l2[K-1])

Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  s=S()
  k=I()

  _s=sorted(s)

  l=[]

  for i in range(3):
    for j in range(len(s)):
      if len(s)>i and _s[i]==s[j]:
        l.append(s[j])

        l.append(s[j:j+2])

        l.append(s[j:j+3])

        l.append(s[j:j+4])

        l.append(s[j:j+5])

  l=list(set(l))
  l.sort()

  return l[k-1]

print(main())


Fixed submission:
# a〜z
l=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

s=list(input())
K=int(input())

l2=[]

a=''
for x in l:
  if x in s:
    a=x
    for i in range(len(s)):
      if s[i]==a:
        for j in range(6):
          l2.append(''.join(s[i:i+j]))

l2=list(set(l2))
l2.remove('')
l2.sort()
print(l2[K-1])

Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  s=S()
  k=I()

  _s=sorted(s)

  l=[]

  for i in range(3):
    for j in range(len(s)):
      if len(s)>i and _s[i]==s[j]:
        l.append(s[j])

        if len(s)-j>=2:
          l.append(s[j:j+2])

        if len(s)-j>=3:
          l.append(s[j:j+3])

        if len(s)-j>=4:
          l.append(s[j:j+4])

        if len(s)-j>=5:
          l.append(s[j:j+5])

  l=list(set(l))
  l.sort()

  return l[k-1]

print(main())


Fixed submission:
# a〜z
l=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

s=list(input())
K=int(input())

l2=[]

a=''
for x in l:
  if x in s:
    a=x
    for i in range(len(s)):
      if s[i]==a:
        for j in range(6):
          l2.append(''.join(s[i:i+j]))

l2=list(set(l2))
l2.remove('')
l2.sort()
print(l2[K-1])