For the ones who don't know, a palindrome is when a string is equal to the string backwards (with exception to interpunction, spaces, etc.). An example of a palindrome is:
If you reverse this, you will end up with:
Which is the same. Therefore, we call this a palindrome. To palindromize things, let's take a look at an example of a string:
This is not a palindrome. To palindromize this, we need to merge the reversed string into the initial string at the right of the initial string, leaving both versions intact. The shorter, the better.
The first thing we can try is the following:
adbcb bcbda ^^ ^^
Not all characters match, so this is not the right position for the reversed string. We go one step to the right:
adbcb bcbda ^^^^
This also doesn't match all characters. We go another step to the right:
This time, all characters match. We can merge both string leaving the intact. The final result is:
This is the palindromized string.
Given a string (with at least one character) containing only lowercase letters (or uppercase, if that fits better), output the palindromized string.
Input Output abcb abcba hello hellolleh bonobo bonobonob radar radar hex hexeh
This is code-golf, so the submission with the least amount of bytes wins!