Longest palindromic substring
Your task
Return the longest contiguous palindromic substring of s. If several have the maximum length, return the one that starts at the earliest index. For the empty string return the empty string. For example "babad" returns "bab" (the earliest-starting of the two length-3 answers). Strings can be up to ~1000 characters; an O(n^2) expand-around-center solution is acceptable.
Examples
longest_palindrome(s: str) -> strExample 1
Input
longest_palindrome("babad")Output
"bab"