Palindrome Permutation

3.8

16 votes
Very-Easy
Problem

A String is called Palindrome if it reads the same backwards as well as forwards. For example, the String aba can be read the same backwards as well as forwards.
Now, a Permutation of a String S is some String K where S and K contain the same set of characters, however, these characters need not necessarily have the same positions. For Example, consider the String abc. Here, the Strings :

  1. acb
  2. bca
  3. bac
  4. cab
  5. cba

are all permutations of it.

Now, given a String S consisting of lowercase English alphabets, you need to find out whether any permutation of this given String is a Palindrome. If yes, print "YES" (Without quotes) else, print "NO" without quotes.

Input Format:
The first and only line of input contains the String S.

Output Format:
Print the required answer on a single line

Constraints:
1|S|1000
S[i][a,z]

Sample Input
abab
Sample Output
YES
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Here, the permutation abba is a palindrome.

Editor Image

?