#C8337. Palindromic Substring Formation

    ID: 52308 Type: Default 1000ms 256MiB

Palindromic Substring Formation

Palindromic Substring Formation

Given a string s of length n, determine whether there exists any substring (of length at least 2) that can be rearranged to form a palindrome. A substring is called palindromable if its characters can be permuted to form a palindrome. For example, in the string "racecar", there are repeated characters that allow the formation of a palindrome by rearrangement, whereas in the string "abcde" no such substring exists. Note that although any single character is a trivial palindrome, substrings of length 1 are not considered in this problem.

Hint: A substring is palindromable if and only if there exists at least one character that appears at least twice.

inputFormat

The input begins with an integer T representing the number of test cases. Each test case consists of two lines: the first line contains an integer n (the length of the string), and the second line contains the string s.

outputFormat

For each test case, output a single line containing "Yes" if there exists a substring (of length at least 2) that can be rearranged to form a palindrome; otherwise, output "No".## sample

2
7 racecar
5 abcde
Yes

No

</p>