in reply to Most common substring

If it's too big to fit in memory, my choice would be to use an external sort (e.g. the unix sort command). Write all the substring to a file, then "sort | uniq -c | sort -rn".

That's the whole program.