Longest Palindromic Substring
InterviewTime limit2sMemory limit512 MB
Given a lowercase string of up to 100,000 characters, report the length of its longest palindromic substring.
- Level
Medium7 of 10
- Topics
- String, String matching, Dynamic programming, Two pointers
- Solved
- No attempts yet
Problem
You are given a string consisting only of lowercase English letters. Write a program that finds the length of the longest substring of that is a palindrome.
A palindrome is a string that reads the same forward and backward. A substring is a contiguous part of .
Input
The first line contains the string , consisting only of lowercase English letters. The length of is at most .
Output
Print the length of the longest substring of that is a palindrome.