substring


Consider a string "babad", the longest palindromic substring is "bab". However, "aba" is also a valid answer. Similarly aabac --> aba gogogh--> gogog Note in the above example ogo is also a palindrome but gogog is the longest one.