Palindromic Substring Discovery
Given a string \(S\), find the largest substring \(W\) such that you can move the characters of \(W\) as you see fit and create a palindrome.
Input Format
\(T\) denoting the number of test cases.
For every \(T\) testcases, there is a single line with \(N\) denoting the length of string in this testcase and \(S\) string.
Output Format
Output \(T\) lines with a single digit each denoting the maximum length possible for \(W\)
Constraints
\[1 \leq T \leq 5\] \[1 \leq N \leq 100000\]Sample Input 0
3
4 abcd
6 aabbcd
7 abcbcda
Sample Output 0
1
5
7
Open on HackerRank ↗ · Markdown source · Back to the archive