#K54502. Longest Palindromic Substring Length

    ID: 29767 Type: Default 1000ms 256MiB

Longest Palindromic Substring Length

Longest Palindromic Substring Length

Given a string s, your task is to find the length of the longest palindromic substring present in s. A palindrome is a string that reads the same backward as forward. In mathematical terms, a string \(S\) is a palindrome if:

\(S = S^{R}\)

where \(S^{R}\) denotes the reverse of \(S\). The input string can be empty or non-empty. Your program should output a single integer which is the maximum length \(L\) for which there exists a substring \(s[i \ldots j]\) (with \(L = j-i+1\)) that is a palindrome.

Example: For the input babad, one possible longest palindromic substring is bab (or aba), so the answer is 3.

inputFormat

The input consists of a single line containing the string s. The string may be empty and will consist of printable characters.

outputFormat

Output a single integer representing the length of the longest palindromic substring found in the input string.

## sample
0