I have a very long string. I want to find all the unique substrings of this string. I tried to write the code where I used a set(python) to store all the substrings
If you really need it in memory, then you can try making a suffix tree. Tries are not exotic data structures, so there are probably good implementations available for a mainstream language like Python, and they can be used to implement suffix trees. Marisa-Trie is supposed to get good memory usage.