(defun LevenshteinDistance (s1 s2) (let ((dp (make-array '(2048 2048))) (n (length s1)) (m (length s2))) (dotimes (i (1+ n)) (setf (aref dp i 0) i)) (dotimes (i (1+ m)) (setf (aref dp 0 i) i)) (dotimes (i n) (dotimes (j m) (setf (aref dp (1+ i) (1+ j)) (1+ (min (aref dp i (1+ j)) (aref dp (1+ i) j))) (aref dp (1+ i) (1+ j)) (min (aref dp (1+ i) (1+ j)) (+ (aref dp i j) (if (char= (char s1 i) (char s2 j)) 0 1)))))) (aref dp n m))) (defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (m (read)) (s1 (read-line)) (s2 (read-line))) (declare (ignore n) (ignore m)) (format t "~d~%" (LevenshteinDistance s1 s2)))) (main)