human
Lexicographically largest sub | Function to return the lexicographically largest sub - sequence of s.
Get the max character from the string.
Use all the occurrences of the current maximum character.
Repeat the steps for the remaining string.
Driver code"
How can the above be solved in Python?
 ... Write me a code to lexicographically largest sub and the other steps required?
assistant
#Here is code to lexicographically largest sub and the other steps required.
 def getSubSeq ( s , n ) :
	res = " "
	cr = 0
	while ( cr < n ) :
		mx = s [ cr ]
		for i in range ( cr + 1 , n ) :
			mx = max ( mx , s [ i ] )
		lst = cr
		for i in range ( cr , n ) :
			if ( s [ i ] == mx ) :
				res += s [ i ]
				lst = i
		cr = lst + 1
	return res
if __name__ == ' _ _ main _ _ ' :
	s = " geeksforgeeks "
	n = len ( s )
	print ( getSubSeq ( s , n ) )