The Longest Palindromic The Longest Palindromic
FR English RU

Write a function that finds the longest palindromic substring of a given string. Try to be as efficient as possible!

If you find more than one substring, you should return the one that’s closer to the beginning.

Input: A text as a string.

Output: The longest palindromic substring.


longest_palindromic('abc') == 'a'
longest_palindromic('abacada') == 'aba'

Precondition: 1 < |text| ≤ 20
The text contains only ASCII characters.