Solved edit distance problem.