#C5276. Palindrome Permutation Checker
Palindrome Permutation Checker
Palindrome Permutation Checker
Given a string, determine if its characters can be rearranged to form a palindrome. A palindrome is a string that reads the same backward as forward. In this problem, consider only alphanumeric characters and ignore cases.
Recall that a string can be permuted to form a palindrome if at most one character appears an odd number of times. Mathematically, if \(f(c)\) denotes the frequency of character \(c\) in the filtered string, the condition is:
[ \sum_{c \in S} \mathbf{1}_{{f(c) \text{ is odd}}} \le 1 ]
Your task is to read a string from standard input and output True
if the string can be rearranged to form a palindrome, and False
otherwise.
inputFormat
The input consists of a single line containing a string which may include letters, digits, spaces, and punctuation.
outputFormat
Output a single line with either True
or False
. There should be no extra characters or spaces in the output.
A man, a plan, a canal: Panama
True