modified editDistance.java