Move all occurrence of letter ' x ' from the string s to the end using Recursion | Function to move all ' x ' in the end ; Store current character ; Check if current character is not 'x ; Recursive function call ; Check if current character is 'x ; Driver code
def moveAtEnd ( s , i , l ) : NEW_LINE INDENT if ( i >= l ) : NEW_LINE return NEW_LINE curr = s [ i ] NEW_LINE DEDENT ' NEW_LINE INDENT if ( curr != ' x ' ) : NEW_LINE INDENT print ( curr , end = " " ) NEW_LINE DEDENT moveAtEnd ( s , i + 1 , l ) NEW_LINE DEDENT ' NEW_LINE INDENT if ( curr == ' x ' ) : NEW_LINE INDENT print ( curr , end = " " ) NEW_LINE DEDENT return NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT s = " geekxsforgexxeksxx " NEW_LINE l = len ( s ) NEW_LINE moveAtEnd ( s , 0 , l ) NEW_LINE DEDENT