def condense_modes(modes)
      action = nil
      result = ''
      modes.split(//).each do |mode|
        if mode =~ /[+-]/ and (!action or mode != action)
          result += mode
          action = mode
          next
        end
        result += mode if mode =~ /[^+-]/
      end
      result.sub!(/[+-]\z/, '')
      return result
    end
def condense_modes(modes)
      action = nil
      result = ''
      modes.split(//).each do |mode|
        if mode =~ /[+-]/ and (!action or mode != action)
          result += mode
          action = mode
          next
        end
        result += mode if mode =~ /[^+-]/
      end
      result.sub!(/[+-]\z/, '')
      return result
    end
Condense mode string by removing duplicates.
 @param [String] modes A string of modes you want condensed.
 @return [Strings] A condensed mode string.