modified editDistance