#C5124. Palindrome Rearrangement Checker

    ID: 48739 Type: Default 1000ms 256MiB

Palindrome Rearrangement Checker

Palindrome Rearrangement Checker

Given a string s consisting only of lowercase Latin letters, determine if it is possible to rearrange its characters to form a palindrome.

A string can be rearranged to form a palindrome if and only if the number of characters that appear an odd number of times is at most one. Mathematically, if we denote by \(f(c)\) the frequency of character \(c\) in the string, then the condition can be written as:

\(\sum_{c \in s} \left[ f(c) \bmod 2 \right] \leq 1\)

For example, for the string "civic", the condition holds since each character count allows at most one odd frequency count.

inputFormat

The input consists of a single line containing a non-empty string s consisting of lowercase Latin letters.

outputFormat

Output a single line: True if the string can be rearranged to form a palindrome, otherwise False.## sample

civic
True