#C11713. Permutation of Palindrome
Permutation of Palindrome
Permutation of Palindrome
Given a string s, determine whether any permutation of s (ignoring non-alphanumeric characters and case) can form a palindrome. In other words, check if the characters of s can be rearranged to create a string that reads the same forwards and backwards.
Mathematically, if we denote the frequency of characters by f(c), then for the string to be a permutation of a palindrome, at most one character can have an odd count. That is, the number of characters with odd frequencies must satisfy $$\text{oddCount} \le 1.$$
You are required to read the input (a single string) from stdin and output either True
or False
to stdout indicating whether the string is a permutation of a palindrome.
inputFormat
The input consists of a single line containing the string s. The string may include spaces, punctuation, and other special characters. Only alphanumeric characters should be considered, and the check should be case-insensitive.
outputFormat
Output a single line, either True
if some permutation of s can form a palindrome, or False
otherwise.
Tact Coa
True