#K83082. Rearrange to Palindrome
Rearrange to Palindrome
Rearrange to Palindrome
Given a string s
consisting of lowercase English letters, determine whether it is possible to rearrange its characters to form a palindrome.
A palindrome is a string that reads the same forward and backward. The task is to output YES if the string can be rearranged into a palindrome, or NO otherwise.
Note: A string can be rearranged into a palindrome if at most one character appears an odd number of times.
For example:
- Input:
aabb
– Output:YES
- Input:
abc
– Output:NO
- Input:
racecar
– Output:YES
inputFormat
The input consists of a single line containing a non-empty string s
of lowercase English letters.
Input is provided via standard input (stdin).
outputFormat
Output a single line with YES
if the string can be rearranged into a palindrome, and NO
otherwise. The output should be sent to standard output (stdout).
aabb
YES