There are many solutions for finding the possible substrings. I have tried this php solution.
However I have specific requirements. I need to generate the substrings using the characters in the order. For ex: if the given string is: 'ABCDE'
Then possible combinations are: 'ABCD', 'ABC', 'ACDE', 'ACD', 'ADE', 'BCDE', 'BCD', 'BDE' and 'CDE'
(length of substring should be more than 2, of-course this is simple to achieve. )
Not allowed combinations: 'EDCBA', 'DBA', 'ECBA', 'AABB' etc
Can any one suggest how can I achieve this? Either PHP or JavaScript solutions are acceptable.