Palindrome#8302

Palindrome

1 second
64 megabytes
Very hard

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.

Input

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

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 .

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading