number of distinct substrings using qsort this has better complexity than suffixarray actually memory used is less in this than suffix array