human
Lexicographical Maximum substring of string | Python 3 program to find the lexicographically maximum substring ..
We store all the indexes of maximum characters we have in the string.
We form a substring from that maximum character index till end and check if its greater that maxstring.
Driver code"
How can the above be solved in Python?
 What is a code to lexicographical Maximum substring of string and the other steps required?
assistant
#Here is code to lexicographical Maximum substring of string and the other steps required.
 def LexicographicalMaxString ( st ) :
	maxchar = ' a '
	index = [ ]
	for i in range ( len ( st ) ) :
		if ( st [ i ] >= maxchar ) :
			maxchar = st [ i ]
			index . append ( i )
	maxstring = " "
	for i in range ( len ( index ) ) :
		if ( st [ index [ i ] : len ( st ) ] > maxstring ) :
			maxstring = st [ index [ i ] : len ( st ) ]
	return maxstring
if __name__ == " _ _ main _ _ " :
	st = " acbacbc "
	print ( LexicographicalMaxString ( st ) )