hello guys i was given homework problem where it asks me to find all distinct substring of a string.
I have implemented a method which will tell you all the substrings of s
public int printSubstrings1(int length) {
Set set = new HashSet();
for(int i=0; i < text.length() - length + 1; i++) {
String sub = text.substring(i,length+i);
set.add(sub);
}
for (String str : set) {
System.out.println(str);
}
return set.size();
}