LearnPy Hub
← Arena
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
solution.py
Output appears here
Shortest Palindrome by Adding in Front · Python Arena problem · LearnPy Hub