Longest Palindrome in a String

Given a string S, find the longest palindromic substring in S. 
Substring of string S: S[ i . . . . j ] where 0 ≤ i ≤ j < len(S).
Palindrome string: A string which reads the same backwards. More formally, S is palindrome if reverse(S) = S.
Incase of conflict, return the substring which occurs first ( with the least starting index).
for example string is "aaaabbaa" The longest Palindromic
substring is "aabbaa".
        
       Input:-aaaabbaa
       Input Description: The first and only line of input contains the String 
       Output: aabbaa
       Output Description: return the longest palindromic substring. 
       Constraints: 1 <=S <=103
       Explanation: null

Loading...