#C7969. Rearrange to Palindrome
Rearrange to Palindrome
Rearrange to Palindrome
You are given a string S
consisting of lowercase English letters. Your task is to determine whether the characters of S
can be rearranged to form a palindrome.
A palindrome is a string that reads the same forwards and backwards. One way to approach this problem is to count the frequency of each character. In a palindrome, at most one character is allowed to have an odd frequency (which would be the middle character if the length of the string is odd). If more than one character has an odd frequency, the string cannot be rearranged into a palindrome.
Input Format: The input will be provided through standard input (stdin).
Output Format: The output should be printed to standard output (stdout) and is either "yes" (if the string can be rearranged to form a palindrome) or "no" (otherwise).
For example, for the input "aabb", the output is "yes" since a valid palindrome could be "abba".
inputFormat
The input consists of a single line containing the string S
(which may be empty). The string is composed of lowercase English letters.
outputFormat
Output a single line containing yes
if the string can be rearranged to form a palindrome, or no
otherwise.
aabb
yes