CF1758A.SSeeeeiinngg DDoouubbllee
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A palindrome is a string that reads the same backward as forward. For example, the strings z , aaa , aba , and abccba are palindromes, but codeforces and ab are not.
The double of a string s is obtained by writing each character twice. For example, the double of seeing is sseeeeiinngg .
Given a string s , rearrange its double to form a palindrome. Output the rearranged string. It can be proven that such a rearrangement always exists.
输入格式
The first line of input contains t ( 1≤t≤1000 ) — the number of test cases.
The only line of each test case contains a single string s ( 1≤∣s∣≤100 ) consisting only of lowercase English letters.
Note that the sum of ∣s∣ over all test cases is not bounded.
输出格式
For each test case, output a palindromic string of length 2⋅∣s∣ that is a rearrangement of the double of s .
输入输出样例
输入#1
4 a sururu errorgorn anutforajaroftuna
输出#1
aa suurruurruus rgnororerrerorongr aannuuttffoorraajjaarrooffttuunnaa
说明/提示
In the first test case, the double of a is aa , which is already a palindrome.
In the second test case, the double of sururu is ssuurruurruu . If we move the first s to the end, we get suurruurruus , which is a palindrome.
In the third test case, the double of errorgorn is eerrrroorrggoorrnn . We can rearrange the characters to form rgnororerrerorongr , which is a palindrome.