R - Longest common substring Check out the "Rlibstree" package on omegahat Github This uses http://www.icir.org/christian/libstree/.