6770.Palindrome Reorder

Time Limit: 1s Memory Limit: 512MB

Given a string, your task is to reorder its letters in such a way that it becomes a palindrome (i.e., it reads the same forwards and backwards).

Input Format(From the terminal/stdin)

The only input line has a string of length $n$ consisting of characters A–Z.

  • $1 \le n \le 10^6$

Output Format(To the terminal/stdout)

Print a palindrome consisting of the characters of the original string. You may print any valid solution. If there are no solutions, print "NO SOLUTION".

Sample Input

Copy
AAAACACBA
         \n

Sample Output special judge

Copy
AACABACAA
         \n
Source: CSES, Introductory Problems, 1755

Submit

请先 登录

© 2025 FAQs