#K45237. Palindromic Permutation Checker
Palindromic Permutation Checker
Palindromic Permutation Checker
Given a string s, check whether any permutation of s can form a palindrome. A string is a palindrome if it reads the same backward as forward. For a palindromic permutation to exist, at most one character can have an odd frequency.
Formally, let \( freq(c) \) be the frequency of character \( c \) in the string. A necessary and sufficient condition for the existence of a palindromic permutation is: \[ \text{Number of characters with } freq(c) \equiv 1 \pmod{2} \le 1 \]
The check is case-sensitive, meaning that uppercase and lowercase letters are considered different.
inputFormat
Input is provided via standard input. It contains a single line with a non-empty string s consisting of letters. The string may include both uppercase and lowercase characters.
outputFormat
Output a single integer to standard output. Print 1
if some permutation of s can form a palindrome, otherwise print 0
.
aabb
1
</p>