Palindromes 100500
It's been a while since we've tackled palindrome problems, so let's dive into one. You are given a string (s), and your task is to find the lexicographically smallest substring of length (L) that is a palindrome.
Remember, a string (a) is considered lexicographically smaller than a string (b) of the same length if there exists an index (i) ((1 i |a|)) such that: (a_1 = b_1), (a_2 = b_2), ..., (a_i-1 = b_i-1), and (a_i < b_i). A palindrome is a string that reads the same forwards and backwards.
Input
The first line contains (L) ((1 L |s|)) - the length of the desired substring. The second line contains (s) ((1 |s| 100500)), which consists of lowercase Latin letters.
Output
Output the lexicographically smallest substring of (s) that has a length of (L) and is a palindrome. If no such substring exists, output "42".