class RuboCop::StringUtil::Jaro

def find_common_characters

def find_common_characters
  common_chars_of_shorter = Array.new(shorter.size)
  common_chars_of_longer = Array.new(longer.size)
  shorter.each_char.with_index do |shorter_char, shorter_index|
    matching_index_range(shorter_index).each do |longer_index|
      longer_char = longer.chars[longer_index]
      next unless shorter_char == longer_char
      common_chars_of_shorter[shorter_index] = shorter_char
      common_chars_of_longer[longer_index] = longer_char
      # Mark the matching character as already used
      longer.chars[longer_index] = nil
      break
    end
  end
  [common_chars_of_shorter, common_chars_of_longer].map(&:compact)
end