#C2867. Palindrome Rearrangement
Palindrome Rearrangement
Palindrome Rearrangement
You are given a string s
. Your task is to determine whether its characters can be rearranged to form a palindrome.
A palindrome is a string that reads the same backward as forward. A key observation is that a string can be rearranged into a palindrome if and only if the number of characters that appear an odd number of times is at most one. Formally, let \( cnt(x) \) denote the number of occurrences of character \( x \) in the string. The string can form a palindrome if and only if \[ \sum_{x} \mathbb{1}_{(cnt(x) \bmod 2 \neq 0)} \le 1, \] where \( \mathbb{1} \) is the indicator function.
Input is read from standard input and output is written to standard output.
inputFormat
The input consists of a single line containing the string s
, which may be empty or consist of lowercase/uppercase letters.
outputFormat
Output True
if the characters of the string can be rearranged to form a palindrome; otherwise, output False
. The output should be printed on a single line.
radar
True