#C5331. Can Form Palindrome
Can Form Palindrome
Can Form Palindrome
Given a string s
, determine whether its characters can be rearranged to form a palindrome. A string can be rearranged to form a palindrome if and only if at most one character appears an odd number of times. For example, the string civic
is already a palindrome, the string ivicc
can be rearranged to civic
, while hello
cannot be rearranged to form a palindrome.
Note: The input is given via standard input and the output must be printed to standard output. The answer should be YES
if a palindrome can be formed, and NO
otherwise.
Examples:
- Input: civic -> Output: YES
- Input: ivicc -> Output: YES
- Input: hello -> Output: NO
inputFormat
The input consists of a single line containing the string s
.
Note that the string may contain any characters and its length can vary.
outputFormat
Output a single line: YES
if the characters of the string can be rearranged to form a palindrome, and NO
otherwise.
civic
YES