#K37707. Longest Palindromic Substring Length

    ID: 26036 Type: Default 1000ms 256MiB

Longest Palindromic Substring Length

Longest Palindromic Substring Length

Given a string \(s\), the task is to find the length of the longest palindromic substring in \(s\). A substring is a contiguous sequence of characters in the string. A palindrome is a string that reads the same backward as forward.

For example, for the string "babad", one possible longest palindromic substring is "bab" which has length 3.

Your solution should correctly handle various edge cases including empty strings and strings where no two adjacent characters are the same.

inputFormat

The input consists of a single line containing the string \(s\). The string may include letters and other characters. You can assume the length of \(s\) does not exceed 1000.

outputFormat

Output a single integer which is the length of the longest palindromic substring in \(s\).

## sample
babad
3