#C372. Palindrome Permutation
Palindrome Permutation
Palindrome Permutation
You are given a string s consisting of lowercase English alphabets. Your task is to determine whether any permutation of s can form a palindrome.
A palindrome is a string that reads the same forward and backward. For a string to be rearranged into a palindrome, at most one character can appear an odd number of times. In other words, if we let \(f(c)\) be the frequency of character c in the string, then the string can form a palindrome if and only if:
[ \sum_{c \in \text{alphabet}} \mathbb{1}_{{f(c) ;\text{is odd}}} \leq 1 ]
Determine whether the given string meets this criterion.
inputFormat
The input consists of a single line containing a string s which has only lowercase English letters.
outputFormat
Output a single line: print YES
if any permutation of the input string can form a palindrome, and NO
otherwise.
civic
YES