#C14642. Palindrome Permutation
Palindrome Permutation
Palindrome Permutation
Given a string, determine whether any permutation of that string can form a palindrome. The check should be case-insensitive and ignore any non-alphabetic characters. A string can be rearranged to form a palindrome if and only if at most one character appears an odd number of times. For instance, the string "Tact Coa" can be rearranged to form "taco cat", which is a palindrome.
Note: Only alphabetic characters are considered. All other characters such as digits, spaces, and punctuation should be ignored. The function should output True
if the string can be permuted to a palindrome and False
otherwise.
inputFormat
The input begins with an integer T (1 ≤ T ≤ 100) on the first line, indicating the number of test cases. Each of the following T lines contains a single string which may include letters, spaces, and punctuation.
outputFormat
For each test case, output True
if any permutation of the input string can form a palindrome, otherwise output False
. Each result should be printed on a separate line.
1
Tact Coa
True