AdvancedRating 1800
Shortest Palindrome by Adding in Front
Add as few characters as possible to the front of the string to make it a palindrome. Print the result.
Input
One string (length ≤ 10⁵).
Output
One string.
Sample 1
Input
aacecaaa
Output
aaacecaaa
Sample 2
Input
abcd
Output
dcbabcd
Output appears here