#K63347. Palindrome Rearrangement
Palindrome Rearrangement
Palindrome Rearrangement
Given an integer N, determine whether its digits can be rearranged to form a palindrome. A rearrangement is possible if and only if the number of digits that occur an odd number of times is at most one. In mathematical terms, let \( odd\_count \) denote the number of digits with an odd frequency; then a palindrome arrangement exists if and only if \( odd\_count \leq 1 \).
For example, for N = 12321
, the answer is YES
because the digits can form a palindrome. For N = 12345
, the answer is NO
since more than one digit appears an odd number of times.
inputFormat
The input consists of a single line containing one integer N (1 ≤ N ≤ 1018).
outputFormat
Output a single line containing YES
if a palindromic rearrangement of the digits of N is possible, otherwise output NO
.
12321
YES