#K58457. Palindrome Rearrangement
Palindrome Rearrangement
Palindrome Rearrangement
You are given a string T
consisting of lowercase English letters. Your task is to determine whether the characters of T
can be rearranged to form a palindrome.
A palindrome is a string that reads the same forwards and backwards. In order for a set of characters to form a palindrome, at most one character is allowed to have an odd frequency count, while every other character must appear an even number of times. Formally, let \( f(c) \) be the frequency of character \( c \) in T
; the string can be rearranged into a palindrome if and only if:
[ \sum_{c \in T} \mathbf{1}_{{ f(c) \text{ is odd} }} \leq 1 ]
If the string is empty, it is considered a palindrome.
inputFormat
The input consists of a single line, which contains the string T
made up of lowercase English letters. Note that the string can be empty.
outputFormat
Print Yes
if the characters of T
can be rearranged to form a palindrome; otherwise, print No
.## sample
radar
Yes