What is correct time complexity of the substring generation algo
To be blunt, the Stack Overflow question and its answers illustrate why you want to ask about such things here.


The propsed algorithm clearly does not run in quadratic time.
Since the length $n$ of the original string is our input size, and the length of the longest possible result string, we can not assume that string comparisons run in constant time.
The bound you give is therefore also wrong, since you can not check in constant time if any string is in a list of size $L$.


Instead, the running time of the algorithm is more complicated and depends on several factors (new variable names).


The length $N$ of the input string.
The number $m$ of output strings. $m \in \Omega(n) \cap O(n^2)$.
The total length $M$ of all output strings. $M \in \Omega(n^2) \cap O(n^3)$.


You should be able to derive rough bounds using standard approaches. Keep in mind to fix the dictionary implementation you use for the "list"! Using, say, tries you get lookup (and insertion) costs bounded by the length of the string at hand.