Lexicographically Least SubstringView as PDF
Brute Force Practice 2
You have a string (indexed from 0) with no more than 50 lowercase characters. Find the lexicographically least substring with a length of at least . A string is said to be lexicographically smaller than a string if and is a prefix of or and . Here, denotes the length of the string.
The first line will have the string.
The second line will have .
Print the lexicographically least substring of length at least .