#C5117. Form a Palindrome
Form a Palindrome
Form a Palindrome
Given a string, determine whether its characters can be rearranged to form a palindrome. A palindrome is a string that reads the same backward as forward. You must ignore spaces and treat uppercase and lowercase letters as the same (the resulting palindrome should be in lowercase).
If a palindrome can be formed, output True
on the first line and one possible palindrome on the second line. If it is impossible to form a palindrome, output False
on the first line and None
on the second line.
Note: If the input is an empty string, it is considered a palindrome with an empty string output.
inputFormat
The input consists of a single line representing the string to be processed. The string may contain spaces and a mix of uppercase and lowercase letters.
outputFormat
Output two lines. The first line should be either True
if a palindrome can be formed (or if the input is empty) or False
otherwise. The second line should be one valid palindrome in lowercase if possible, or None
if no palindrome can be formed.
a
True
a
</p>