solve the edit distace problem.