#C5673. Palindrome Permutation

    ID: 49348 Type: Default 1000ms 256MiB

Palindrome Permutation

Palindrome Permutation

Given a string s, determine if its characters can be rearranged to form a palindrome. A palindrome is a word or phrase that reads the same backward as forward. The task is to decide whether there exists a permutation of s that is a palindrome.

In a valid palindrome, at most one character may appear an odd number of times. For example, "civic" is already a palindrome and "ivicc" can be rearranged to form "civic". However, "hello" cannot be rearranged to form any palindrome.

Note: The input is read from standard input (stdin) and the output should be printed to standard output (stdout).

Mathematically, let \( f(c) \) be the frequency of character \( c \) in s. A palindrome can be formed if and only if:

[ \sum_{c}\mathbf{1}_{{f(c) ; mod ; 2 \neq 0}} \leq 1 ]

inputFormat

The input consists of a single line containing a string s composed of lowercase English letters. The string may be empty.

For example:

civic

outputFormat

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

For example:

True
## sample
civic
True