You are having a string S of length N containing only lowercase English letters. You perform the following operation on the above string: Delete some substring of this string. Try permuting the remaining characters of the string such that they become a palindrome.
Determine the minimum length substring to remove from the string S such that the remaining characters can be rearranged into a palindrome.
Samples:
Sample input 1: 2 7 abbcdde 5 abcdc
Sample output 1: 4 2
Sample input 2: 2 2 gx 5 puamk
Sample output 2: 1 4