### Question:
StringEditDistance { public static int DL(String first, String second) { int i, j; int[][] A; A = new int[3][second.length() + 1]; A[0][0] = 0; for (j = 1; j <= second.length(); ++j) { A[0][j] = A[0][j - 1] + 1; } for (i = 1; i <= first.length(); ++i) { A[i % 3][0] = A[(i - 1) % 3][0] + 1; for (j = 1; j <= second.length(); ++j) { if (first.charAt(i - 1) == second.charAt(j - 1)) { A[i % 3][j] = A[(i - 1) % 3][j - 1]; } else { if (i > 1 && j > 1 && first.charAt(i - 1) == second.charAt(j - 2) && first.charAt(i - 2) == second.charAt(j - 1)) { A[i % 3][j] = min(A[(i - 1) % 3][j] + 1, A[i % 3][j - 1] + 1, A[(i - 2) % 3][j - 2] + 1); } else { A[i % 3][j] = min(A[(i - 1) % 3][j] + 1, A[i % 3][j - 1] + 1, A[(i - 1) % 3][j - 1] + 1); } } } } return A[first.length() % 3][second.length()]; }  static int indel(String first, String second); static int levenshtein(String first, String second); static int DL(String first, String second); static int distance(String first, String second, EditDistanceType type); static BiCounter<Character, EdOp> operations(String first, String second); static int[] alignment(String first, String second);  }### Answer:
@Test public void testDLDistance() { System.out.println("Damerau-Levenshtein Distance"); String first = "abracadabra"; String second = "arbadacarba"; int expResult = 4; int result = StringEditDistance.DL(first, second); assertEquals(expResult, result); }