#C5158. Palindrome Rearrangement
Palindrome Rearrangement
Palindrome Rearrangement
Given a string \( s \), determine whether it can be rearranged to form a palindrome. A string can be rearranged into a palindrome if and only if at most one character appears an odd number of times. In other words, if we denote by \( f(c) \) the frequency of character \( c \) in the string, then the condition is:
\( \sum_{c} [f(c) \bmod 2 = 1] \le 1 \)
For example, the string "civic" can be rearranged to form a palindrome, whereas "hello" cannot.
inputFormat
The input consists of a single line containing the string \( s \). The string may be empty.
outputFormat
Print True
if the string can be rearranged to form a palindrome; otherwise, print False
.
civic
True