#C3439. Make Palindrome
Make Palindrome
Make Palindrome
Given a string S consisting of lowercase English letters, your task is to rearrange the characters of S to form a palindromic string. A palindrome is a string that reads the same forwards and backwards. If it is impossible to rearrange S into a palindrome, output Not Possible
. If multiple palindromic arrangements exist, output the lexicographically smallest one.
Note: The lexicographically smallest string is the one that comes first in dictionary order. For example, among "bbaabb" and "abbabb", the string "abbabb" is lexicographically smaller.
Hint: A palindrome can have at most one character with an odd frequency. Use this property to determine if a palindrome formation is possible.
inputFormat
The input is provided via standard input. It consists of a single line containing the string S (which may be empty) composed of lowercase English letters.
outputFormat
Output a single line via standard output. This line should contain the palindromic permutation of S if it exists, or Not Possible
if no palindromic rearrangement can be formed.
abccba
abccba