Generalized longest common substring problem solved. Function is placed
inside the library.