#C10574. Rearrange Palindrome

    ID: 39794 Type: Default 1000ms 256MiB

Rearrange Palindrome

Rearrange Palindrome

Given a string consisting of lowercase English letters, determine whether its letters can be rearranged to form a palindrome.

A palindrome is a word that reads the same backward as forward. A necessary and sufficient condition for a string ( s ) to be rearranged into a palindrome is that at most one character has an odd frequency. In other words, if ( n_c ) denotes the frequency of character ( c ) in ( s ), then ( s ) can be rearranged into a palindrome if and only if $$\sum_{c \in s} [n_c \mod 2 \neq 0] \leq 1.$$

inputFormat

The input consists of a single line containing a non-empty string ( s ) that consists solely of lowercase English letters.

outputFormat

Output a single line with either 'True' (without quotes) if the string can be rearranged to form a palindrome, or 'False' otherwise.## sample

aabb
True

</p>