Given a string composed of lowercase Latin letters, your task is to determine the longest palindrome that can be formed by deleting up to characters.
A palindrome is a non-empty string that reads the same forwards and backwards.
The first line contains a sequence of lowercase Latin letters (the string's length does not exceed characters).
The second line contains the integer (0 \leq M \leq 1000), representing the maximum number of deletions allowed.
Output the longest palindrome by length. If there are multiple palindromes of the same length, choose the one that comes first in alphabetical order.
If forming a palindrome is not possible, output .
Example 1
Example 2