#C2103. Beautiful Palindrome
Beautiful Palindrome
Beautiful Palindrome
Given a string s, determine whether its characters can be rearranged to form a palindrome. A palindrome is a string that reads the same forwards and backwards. Formally, a string s can be rearranged into a palindrome if and only if at most one character has an odd frequency. In mathematical terms, let the frequency of each character be \( f_i \). Then a rearrangement exists if \( \sum_{i} [f_i \bmod 2] \leq 1 \).
Your task is to check if such a rearrangement exists. If it does, print YES
; otherwise, print NO
.
inputFormat
The input consists of a single line containing the string s. The string may be empty, in which case it is considered a valid palindrome.
outputFormat
Output a single line containing either YES
if the input string can be rearranged into a palindrome, or NO
otherwise.
civic
YES