human
Lexicographically largest string possible by repeatedly appending first character of two given strings | Function to make the lexicographically largest string by merging two strings.
Stores the resultant string.
If the string word1 is lexographically greater than or equal to word2.
Update the string merge.
Erase the first index of the string word1.
Otherwise.
Update the string merge.
Erase the first index of the string word2.
Return the final string.
Driver code"
How can the above be solved in Python?

Give me a code to lexicographically largest string possible by repeatedly appending first character of two given strings and the other steps required?
assistant
#Here is code to lexicographically largest string possible by repeatedly appending first character of two given strings and the other steps required.
 def largestMerge ( word1 , word2 ) :
	merge = " "
	while len ( word1 ) != 0 or len ( word2 ) != 0 :
		if word1 >= word2 :
			merge = merge + word1 [ 0 ]
			word1 = word1 [ 1 : ]
		else :
			merge = merge + word2 [ 0 ]
			word2 = word2 [ 1 : ]
	return merge
S1 = " xyzxyz "
S2 = " xywzxyx "
print ( largestMerge ( S1 , S2 ) )