#K56382. Palindromic Rearrangement
Palindromic Rearrangement
Palindromic Rearrangement
You are given a string s
consisting of lowercase English letters. Your task is to determine whether the characters of the string can be rearranged to form a palindrome.
A string is considered a palindrome if it reads the same backward as forward. In order for a rearrangement of the string to form a palindrome, at most one character can appear an odd number of times while all other characters must appear an even number of times.
For example, the string aabb
can be rearranged as abba
which is a palindrome, while the string abc
cannot be rearranged into a palindrome.
Determine if the given string meets this criterion.
Note: If the string can be rearranged into a palindrome, output YES
, otherwise output NO
.
inputFormat
The input consists of a single line containing the string s
, which is composed of lowercase English letters only.
outputFormat
Output a single line containing YES
if the string can be rearranged into a palindrome, otherwise output NO
.
aabb
YES