#K6901. Longest Even-Length Palindromic Substring

    ID: 32991 Type: Default 1000ms 256MiB

Longest Even-Length Palindromic Substring

Longest Even-Length Palindromic Substring

Given a string S, find the length of the longest contiguous substring of S that is a palindrome and has an even length. A palindrome is a string that reads the same backwards and forwards. For example, in the string abbaacc, the longest even-length palindromic substring is abba with a length of 4.

The problem can be formulated as follows:

Given a string \( S \), determine the maximum even integer \( L \) such that there exists a substring of S of length \( L \) which is a palindrome.

Note: If there is no even-length palindromic substring, output 0.

inputFormat

The input consists of a single line containing the string S.

outputFormat

Output a single integer representing the length of the longest even-length palindromic substring in S. If there is no such substring, output 0.

## sample
abbaacc
4