What is the fastest way to find all the substrings in a string without using any modules and without making duplicates
def lols(s):
if not s:
return 0
lst = []
for i in range (len(s)):
for j in range(i , len(s)+1):
if not s[i:j] :
pass
elif len(s[i:j]) == len(set(s[i:j])):
lst.append(s[i:j])
res = (max(lst , key=len))
s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
s = s*100
lols(s)
this function works fine with strings smaller than 1000, but it freezes when the example string is used and a time limit is exceeded for large strings