Description

A palindrome is a sequence of characters which reads the same backwards and forwards. Given the string s, complete a solution function that returns the length of the longest palindrome within the substrings of s.

For example, when string s is "abcdcba", return 7.

Constraints
  • Length of string s: a natural number less than or equal to 2,500
  • The string s consists only of lowercase alphabetic characters

Example
s answer
"abcdcba" 7
"abacde" 3

Example #1
Returns 7 because the whole string s is palindrome based on the fourth digit "d".

Example #2
Returns 3 because "aba" is the palindrome based on the second digit "b".

Result Stop
Result of [Run Test] or [Submit] will be displayed here
내가 제출한 코드가 왜 틀렸는지 프로그래머스 AI에게 물어보세요.
제출 후 채점하기를 눌러 30점 이상인 경우 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.