calculating the edist distance for approx string matching, pre DP