public static int edit3(String string1, String string2){
        int length1, length2;
        length1 = string1.length();
        length2 = string2.length();

        int F[][] = new int[length1+1][length2+1];

        for(int i = 0; i <= length1; i++) {
            F[i][0] = i;
        }
        for(int i = 0; i <= length2; i++) {
            F[0][i] = i;
        }

        for(int i = 1; i <= length1; i++) {
            for(int j = 1; j <= length2; j++) {
                F[i][j] = min3(F[i-1][j] + 1,
                        F[i][j-1] + 1,
                        F[i-1][j-1] + equal(string1.charAt(i-1),string2.charAt(j-1)));
            }
        }
        return  F[length1][length2];
    }