#C3384. Rearrange to Palindrome
Rearrange to Palindrome
Rearrange to Palindrome
Given a string consisting solely of lowercase English letters, determine whether its characters can be rearranged to form a palindrome. A palindrome is a string that reads the same backward and forward. According to the necessary condition, at most one character in the string may have an odd frequency. If this condition is satisfied, then the string can be rearranged to form a palindrome.
For instance, the string ivicc
can be rearranged into civic
, which is a palindrome, whereas the string hello
cannot form any palindrome.
The decision should be based on the frequency of each character using the formula:
$$ odd\_counts \leq 1 $$
inputFormat
The input consists of a single line containing a string of lowercase English letters.
outputFormat
Print a single line with either "True" if the string can be rearranged into a palindrome, or "False" if it cannot.## sample
civic
True