Double string

3.4

53 votes
Problem

George doesn’t like palindromes. But he likes Double Strings.Double Strings are strings of even length and the first half of the string is equal to the second half of it. So he wants to know if he can change the given palindrome into a Double String. Since he is also cautious about the length of the Double String he wants you to find the maximum possible number of characters in the Double String which is made from a palindrome.

Rules: You can change the palindrome to a Double String either by removing a character or interchanging characters or both any number of times.

Input: The first line contains the number of test cases T. Next T lines contain each an integer denoting the length of the palindrome.

Output: For each test case output an integer denoting the maximum possible number of characters in the Double String made after the changes.

Constraints:

1<=T<=1000

1<=N<=1000000

Sample Input:

2

2

4

Sample Output:

2

4

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?