#C12366. Palindrome Rearrangement
Palindrome Rearrangement
Palindrome Rearrangement
You are given a string s
. Your task is to determine whether any permutation of the filtered string can form a valid palindrome.
The filtering process involves removing all non-alphabetic characters and converting all remaining letters to lowercase. A string can be rearranged to form a palindrome if and only if at most one character appears an odd number of times.
For example, consider the string:
"racecar racing"
becomes"racecarracing"
after filtering. Since more than one character appears an odd number of times, it cannot form a palindrome."A man, a plan, a canal, Panama"
after filtering becomes"amanaplanacanalpanama"
, which can be rearranged into a palindrome.
Your program should read the input string from stdin and output either True
or False
to stdout based on whether a palindrome can be formed.
Note: If the string is empty after filtering, it is considered a valid palindrome.
inputFormat
The input consists of a single line containing the string s
.
You should read the input from standard input (stdin).
outputFormat
Output a single line: True
if a permutation of the filtered string can form a palindrome, otherwise False
.
The output should be written to standard output (stdout).
## sampleracecar racing
False