Traverse the and store the last index of every character
for i in range ( len ( strr ) - 1 , - 1 , - 1 ) : NEW_LINE INDENT if ( strr [ i ] not in m ) : NEW_LINE INDENT m [ strr [ i ] ] = i NEW_LINE DEDENT DEDENT i = 0 NEW_LINE