Given a string s, return the smallest contiguous substring you can remove to create a palindrome.
Examples:
800233008 -> 2 racecarFOOL -> FOOL abcdedcba -> (empty string) ngryL Myrgn -> "L " (or " M") 123456789 -> 12345678 (or 23456789) aabcdbaa -> c (or d) [[]] -> [[ (or ]]) a -> (empty string) Test case suggestions from users (if you find an edge case not listed, please post a comment):
aabaab -> b | Suggested by Zgarb, some returned "aa". Rules
- Only printable ASCII characters will appear in the input (no newlines, keep it simple).
- Not really a rule, but note
<>,/\,(),[]and{}are not palindromes.
This is code-golf, smallest byte-count wins.
+100 bounty has been claimed by Adnan
aabaab\$\endgroup\$[[]]a palindrome? \$\endgroup\$]][[. Consider thataabbis the same thing, just different characters. \$\endgroup\$