Lew sends Chris a string and asks for its longest palindromic substring. During the process, someone hacked the file and changed one character.
Chris wonders, what could be the length of the longest palindromic substring in the initial string?
Here is the string after the modification.
Sample Input
dabcaaef
Sample Output
5
Explanation
If we change the fifth character to
b
then the longest palindromic substring is
abcba
. There will be no palindromic substring longer than this after any modification of one character.
Details and Assumptions
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
No explanations have been posted yet. Check back later!