Modify array of strings by replacing characters repeating in the same or remaining strings | Function to remove duplicate characters across the strings ; Stores distinct characters ; Size of the array ; Stores the list of modified strings ; Traverse the array ; Stores the modified string ; Iterate over the characters of the modified string ; If character is already present ; Insert character into the Set ; Print the list of modified strings ; Print each string ; Driver Code ; Given array of strings ; Function Call to modify the given array of strings
def removeDuplicateCharacters ( arr ) : NEW_LINE INDENT cset = set ( [ ] ) NEW_LINE n = len ( arr ) NEW_LINE out = [ ] NEW_LINE for st in arr : NEW_LINE INDENT out_curr = " " NEW_LINE for ch in st : NEW_LINE INDENT if ( ch in cset ) : NEW_LINE INDENT continue NEW_LINE DEDENT out_curr += ch NEW_LINE cset . add ( ch ) NEW_LINE DEDENT if ( len ( out_curr ) ) : NEW_LINE INDENT out . append ( out_curr ) NEW_LINE DEDENT DEDENT for i in range ( len ( out ) ) : NEW_LINE INDENT print ( out [ i ] , end = " ▁ " ) NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT arr = [ " Geeks " , " For " , " Geeks " , " Post " ] NEW_LINE removeDuplicateCharacters ( arr ) NEW_LINE DEDENT