#K67792. Can Rearrange To Palindrome
Can Rearrange To Palindrome
Can Rearrange To Palindrome
Given a string S, determine if it is possible to rearrange the characters of S to form a palindrome. A palindrome is a string that reads the same backward as forward. In a valid palindrome, at most one character may appear an odd number of times, while all other characters must appear an even number of times.
For example, the string civic can be rearranged into a palindrome (it is already one), while the string hello cannot.
The condition for a string to be rearranged into a palindrome can be expressed by the following formula in LaTeX:
$$ \sum_{i=1}^{n} [count(c_i) \mod 2] \leq 1 $$
inputFormat
The input consists of a single line containing the string S. The string is read from standard input.
outputFormat
Output a single line: True
if the string can be rearranged to form a palindrome, otherwise False
. The result is printed to standard output.
civic
True
</p>