longest common substring using qsort this has better complexity than suffixarray actually memory used is less in this than suffix array