human
K | Python3 implementation of the above approach.
Set to store the unique substring.
String to create each substring.
adding to set.
converting set into a list.
sorting the strings int the list into lexicographical order.
printing kth substring.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to k and the other steps required.
 def kThLexString ( st , k , n ) :
	z = set ( )
	for i in range ( n ) :
		pp = " "
		for j in range ( i , i + k ) :
			if ( j >= n ) :
				break
			pp += s [ j ]
			z . add ( pp )
	fin = list ( z )
	fin . sort ( )
	print ( fin [ k - 1 ] )
s = " geeksforgeeks "
k = 5
n = len ( s )
kThLexString ( s , k , n )