Check if the characters at position i are different , then the word containing lower valued character is smaller
if ( mp [ a [ i ] ] != mp [ b [ i ] ] ) : NEW_LINE INDENT if mp [ a [ i ] ] < mp [ b [ i ] ] : NEW_LINE INDENT return - 1 NEW_LINE DEDENT else : NEW_LINE INDENT return 1 NEW_LINE DEDENT DEDENT