Trying to get a list of all substrings currently I have a function but it’s not fully complete. Im using minimum char of 4. What would be a good approach to complement this:
Im also need to find words like “predict”, how can this be done best and fastest?
Output
Word: predictions
Substring: predictions
Substring: redictions
Substring: edictions
Substring: dictions
Substring: ictions
Substring: ctions
Substring: tions
Substring: ions
The following will create a substring trimming from the right and left of the word down to length of 4 in the same loop. That was the specification I understood.
Assumption: By words you mean substrings.
Note: I also added the logic for a minimum length of 4 characters as well as micro-optimized the
forloop (static limit and pre-increment counter).