human
Remove last occurrence of a word from a given sentence string | Function to remove last occurrence of W from S.
If M is greater than N.
Iterate while i is greater than or equal to 0.
of W has been found or not.
Iterate over the range [ 0 , M ].
If S [ j + 1 ] is not equal to W [ j ].
Mark flag true and break.
If occurrence has been found.
Delete the subover the range [ i , i + M ].
Resize the S.
Return S.
Driver Code.
Input.
Function call"
Solution in Python:

=====
Give me a code to remove last occurrence of a word from a given sentence string and the other steps required?
assistant
#Here is code to remove last occurrence of a word from a given sentence string and the other steps required.
 def removeLastOccurrence ( S , W , N , M ) :
	S = [ i for i in S ]
	W = [ i for i in W ]
	if ( M > N ) :
		return S
	for i in range ( N - M , - 1 , - 1 ) :
		flag = 0
		for j in range ( M ) :
			if ( S [ j + i ] != W [ j ] ) :
				flag = 1
				break
		if ( flag == 0 ) :
			for j in range ( i , N - M ) :
				S [ j ] = S [ j + M ]
			S = S [ : N - M ]
			break
	return " " . join ( S )
if __name__ == ' _ _ main _ _ ' :
	S = " This ▁ is ▁ GeeksForGeeks "
	W = " Geeks "
	N = len ( S )
	M = len ( W )
	print ( removeLastOccurrence ( S , W , N , M ) )