#C10249. Palindromic Permutation
Palindromic Permutation
Palindromic Permutation
Given a string s, determine whether any permutation of the characters in s can form a palindrome.
A palindrome is a string that reads the same forwards and backwards. The permutation of the input string is allowed, but non-letter characters should be ignored and the case of the letters does not matter. In a palindrome, at most one character can have an odd count.
For example:
- "aabb" returns
True
because "abba" is a palindrome. - "aabbc" returns
True
because one possible permutation is "abcba". - "abc" returns
False
because no permutation can form a palindrome.
Your task is to read the input string from the standard input and output True
if a palindromic permutation exists, and False
otherwise.
inputFormat
The input consists of a single line containing the string s.
Note: The string can include spaces, punctuation, and mixed-case letters.
outputFormat
Output a single line containing either True
or False
indicating whether any permutation of the string can form a palindrome.
aabb
True