Computer Science, asked by naviajit1537, 5 hours ago

Question 21
Max. score: 20.00 3
Not A Palindrome
Given a string S and we can swap two adjacent character any number of times (including O). A string will be called Anti-Palindrome if it is not a
palindrome. If it is possible to make the string Anti-Palindrome then find the lexicographically largest Anti-Palindrome, otherwise print -1.
Example
Assume that S = "caac"
Here, Lexicographically largest Anti-Palindrome will be "ccaa".
Function description
Complete the solve function provided in the editor. This function takes the following 1 parameter and returns find the lexicographically largest Anti-
Palindrome, otherwise print -1.
S: Represents the string
Input Format
Note: This is the input format that you must use to provide custom input (available above the Compile and Test button).
The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
Each line contain a string S of lower case alphabets only.
Output Format:
For each test case print the answer in new line.​

Answers

Answered by bhattarairekhakoiral
1

Answer:

दुध्दज्डजदज्डजदज्डजदज्डजदज्डजदज्डजड्डज्डजेउरीरीर

Similar questions