import java.util.*; import java.lang.*; import java.io.*; public class Main { { for(int i=0;i<a.length();i++) { for(int j=i+1;j<=a.length();j++) { c.add(a.substring(i,j)); } } HashSet<String> unique = new HashSet<String>(c); Vector<String> d = new Vector<String>(unique); } }
ALPHABET
[A, B, BE, LP, ABE, ALP, LPH, PHABE, E, PHA, H, ALPHA, L, HABET, ABET, P, PHABET, T, HABE, LPHA, AB, LPHABET, HAB, AL, ALPHABET, ALPHABE, ET, BET, LPHAB, PH, LPHABE, HA, ALPHAB, PHAB, ALPH]35