Account
GitHubFeedback
Drafts and results saved on this device
Submit on CSES.fi
CSES Problemset/Introductory Problems

Palindrome Reorder

#1755
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

Time limit:1.00 s
Memory limit:512 MB
Unsolved
Download Tests (.zip)

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

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

Output

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".

Constraints
  • 1≤n≤1061 \le n \le 10^6
Sample Test Cases (1)
Example 1ID: sample-1
Input
AAAACACBA
Expected Output
AACABACAA
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 chars
Test Bench
Download .zip
Input (stdin)
AAAACACBA
Expected Output
AACABACAA