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 ~K~. A string ~S~ is said to be lexicographically smaller than a string ~T~ if ~|S| < |T|~ and ~S~ is a prefix of ~T~ or ~S_k < T_k~ and ~S_i = T_i~ ~(0 \le i < k, 0 \le k < \min(|S|, |T|))~. Here, ~|X|~ denotes the length of the string.
The first line will have the string.
The second line will have ~K~.
Print the lexicographically least substring of length at least ~K~.