#K91677. Palindrome Permutation

    ID: 38029 Type: Default 1000ms 256MiB

Palindrome Permutation

Palindrome Permutation

Given a string consisting of lowercase English letters, check whether any permutation of the string can form a palindrome.

A palindrome is a string that reads the same forward and backward. A permutation of the string is a reordering of its characters. The task is to determine if it is possible to rearrange the letters such that the resulting string is a palindrome.

The necessary and sufficient condition for a string to have a palindromic permutation is that at most one character appears an odd number of times. In mathematical terms, if \( f(c) \) is the frequency of character \( c \) in string \( s \), then \( s \) can be rearranged into a palindrome if and only if:

\( \sum_{c\in s} \mathbb{1}_{\{f(c) \;\%\; 2 \neq 0\}} \le 1 \)

Read the input from standard input and output the result to standard output.

inputFormat

The input consists of a single line containing a non-empty string of lowercase alphabetical characters.

Example:

civic

outputFormat

Output a single line with either True or False (without quotes), indicating whether any permutation of the given string can form a palindrome.

Example:

True
## sample
civic
True