edit distance algorithm for diff