Update indices of X , Y , Z ;
for i in range ( n ) : NEW_LINE INDENT if s [ i ] in mp : NEW_LINE INDENT mp [ s [ i ] ] . append ( i ) ; NEW_LINE DEDENT else : NEW_LINE INDENT mp [ s [ i ] ] = [ i ] ; NEW_LINE DEDENT DEDENT