

str = "ababc"
The longest palindromic substring of "ababc" is "aba", since "aba" is a palindrome and it is the longest substring of length 3 which is a palindrome.
There is another palindromic substring of length 3 is "bab". Since starting index of "aba" is less than "bab", so "aba" is the answer.
The first line contains a string 'str'.
The output contains the size of the longest palindromic substring if that substring is the answer, else -1.
You do not need to print anything; it has already been taken care of. Just implement the given function.
Try to solve it using O(1) space complexity.
For expanding :