#K77272. Palindrome Permutation Checker

    ID: 34828 Type: Default 1000ms 256MiB

Palindrome Permutation Checker

Palindrome Permutation Checker

In this problem, you are given a set of strings. For each string, determine whether any permutation of the string (ignoring spaces and case) can form a palindrome. A string can be rearranged to form a palindrome if and only if the frequency of characters allows at most one character to appear an odd number of times. In other words, if we let ( f(c) ) be the frequency of a character ( c ) (after converting all letters to lowercase and ignoring spaces), the condition is: [ \sum_{c \in S} [ f(c) \mod 2 \neq 0 ] \leq 1 ] where ([\cdot]) is the Iverson bracket.

Your task is to implement the solution for checking this property for each string provided.

inputFormat

The input is read from standard input and consists of multiple lines. The first line contains an integer ( T ) indicating the number of test strings. This is followed by ( T ) lines, each containing a single string. Spaces in the string should be ignored and the check is case-insensitive.

outputFormat

For each test string, print a single line to standard output containing either "True" if the string can be rearranged to form a palindrome, or "False" otherwise.## sample

1

True

</p>