# Java Substring Comparisons

### Problem Statement :

```We define the following terms:

Lexicographical Order, also known as alphabetic or dictionary order, orders characters as follows:
A<B<...<Y<Z<a<b<...<y<z
For example, ball < cat, dog < dorm, Happy < happy, Zoo < ball.
A substring of a string is a contiguous block of characters in the string. For example, the substrings of abc are a, b, c, ab, bc, and abc.

Given a string, s, and an integer, k, complete the function so that it finds the lexicographically smallest and largest substrings of length k.

Input Format

The first line contains a string denoting s.
The second line contains an integer denoting k.

Constraints
1<=|s|<=1000
s consists of English alphabetic letters only (i.e., [a-zA-Z]).

Output Format

Return the respective lexicographically smallest and largest substrings as a single newline-separated string.```

### Solution :

```                            ```Solution in C :

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String line = scanner.nextLine();
int k = scanner.nextInt();
String minSubstring = line.substring(0,k);
String maxSubstring = line.substring(0,k);
for (int i = 1; i < line.length()-k+1; i++) {
String sub = line.substring(i,i+k);
if (sub.compareTo(minSubstring) < 0) {
minSubstring = sub;
}
if (sub.compareTo(maxSubstring) > 0) {
maxSubstring = sub;
}
}
System.out.println(minSubstring);
System.out.println(maxSubstring);
}
}```
```

## Delete a Node

Delete the node at a given position in a linked list and return a reference to the head node. The head is at position 0. The list may be empty after you delete the node. In that case, return a null value. Example: list=0->1->2->3 position=2 After removing the node at position 2, list'= 0->1->-3. Function Description: Complete the deleteNode function in the editor below. deleteNo

## Print in Reverse

Given a pointer to the head of a singly-linked list, print each data value from the reversed list. If the given list is empty, do not print anything. Example head* refers to the linked list with data values 1->2->3->Null Print the following: 3 2 1 Function Description: Complete the reversePrint function in the editor below. reversePrint has the following parameters: Sing

Given the pointer to the head node of a linked list, change the next pointers of the nodes so that their order is reversed. The head pointer given may be null meaning that the initial list is empty. Example: head references the list 1->2->3->Null. Manipulate the next pointers of each node in place and return head, now referencing the head of the list 3->2->1->Null. Function Descriptio