All unique substring in a string
import java.util.Scanner; public class UniqueSubstringOfAString { public static void main(String args[]){ String input,sub; int i,c,length; Scanner scanner=new Scanner(System.in); input=scanner.nextLine(); length=input.length() for(c=0;c < length;c++) { for(i=1;i <=length-c;i++) { sub=input.subString(c,c+i); System.out.prinln(sub); } } } }
No comments:
Post a Comment