diff --git a/JAVA/SubstringComparisons.java b/JAVA/SubstringComparisons.java new file mode 100644 index 0000000..8b8baed --- /dev/null +++ b/JAVA/SubstringComparisons.java @@ -0,0 +1,43 @@ +import java.util.Scanner; + +public class SubstringComparisons { + + public static String getSmallestAndLargest(String s, int k) { + String smallest = ""; + String largest = ""; + + String small="",large=""; + int length=s.length(); + int times=length-k+1; + String[] word=new String[times]; + for(int i=0;i0) + large=word[i]; + else + continue; + } + smallest=small; + largest=large; + + return smallest + "\n" + largest; + } + + + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + String s = scan.next(); + int k = scan.nextInt(); + scan.close(); + + System.out.println(getSmallestAndLargest(s, k)); + } +}