LongestCommonSubsequence { public Map<Integer, Integer> getLCSMatchMap(List<T> seq1, List<T> seq2) { List<T> mySeq1 = addDummyStart(seq1, null); List<T> mySeq2 = addDummyStart(seq2, null); double[][] table = getTable(mySeq1, mySeq2); return getBackTraceMap(table, mySeq1, mySeq2, mySeq1.size() - 1, mySeq2.size() - 1); }  List<IntPair> getLCSMatch(List<T> seq1, List<T> seq2); List<IntPair> getLCSMatch(T[] seq1, T[] seq2); Map<Integer, Integer> getLCSMatchMap(List<T> seq1, List<T> seq2); Map<Integer, Integer> getLCSMatchMap(T[] seq1, T[] seq2); static Map<Integer, Integer> getCharacterLCSMap(String s1, String s2); static List<IntPair> getCharacterLCS(String s1, String s2);  }
@Test public void testGetLCSMatchMap() { String s1 = "Mr. John Smith-Murray died at Denver, CO."; String s2 = "Mr. John Smith - Murray died at Denver , CO ."; Map<Integer, Integer> match = LongestCommonSubsequence.getCharacterLCSMap(s1, s2); for (int i = 0; i < s1.length(); i++) { assertEquals(s1.charAt(i), s2.charAt(match.get(i + 1) - 1)); } }