#C12263. Rearrange to Palindrome
Rearrange to Palindrome
Rearrange to Palindrome
You are given a string s. Your task is to determine if it is possible to rearrange the characters of the string to form a palindrome.
A palindrome is a string that reads the same forward and backward. For a string of length \( n \), the necessary and sufficient condition is that at most one character has an odd frequency count. In other words, let \( f(c) \) be the frequency of character \( c \) in \( s \). The string can be rearranged into a palindrome if and only if:
\( \sum_{c}\mathbb{1}_{\{f(c) \;\text{is odd}\}} \leq 1 \)
Given the input string, print True
if it can be rearranged into a palindrome, otherwise print False
.
inputFormat
The input consists of a single line containing the string s (which may be empty). The string contains only ASCII characters.
outputFormat
Output a single line: True
if the string can be rearranged into a palindrome, and False
otherwise.
ivicc
True