#K95487. 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 string is a palindrome if it reads the same backwards and forwards. Mathematically, a string of length n can be rearranged into a palindrome if at most one character appears an odd number of times. In other words, if we denote the number of characters with odd frequencies by \(odd\_count\), then the necessary and sufficient condition is:
[ odd_count \le 1 ]
For example, the string "ivicc" can be rearranged into "civic", which is a palindrome, while "otter" cannot form any palindrome. Solve the problem using the standard input and output (stdin and stdout).
inputFormat
The input consists of a single line containing a string s
with only lowercase English letters.
outputFormat
Output a single line: True
if the letters of s
can be rearranged to form a palindrome, otherwise False
.
civic
True