問題一覧 > 通常問題

No.765 ukuku 2

レベル : / AI推定難易度 : 1900 / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 26
作問者 : treeone / テスター : ei1333333
お気に入りにしたユーザー ProblemId : 2514 / 自分の提出
問題文最終更新日: 2018-12-12 20:55:11
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
Advent Calendar Contest 2018 (順位表) の他の問題:

Problem Statement

Define the 'Tapisa' of a string as the length of the longest palindrome contained in that string.
You are given a string $S$. When $1$ character in $S$ is deleted, find the maximum possible 'Tapisa' of the string.

Input

$S$

$S$ is a string consisting of lowercase letters and satisfies $2 \leq |S| \leq 2 \times 10^5$. ( $|S|$ is the length of the string $S$ )

Output

Print the answer on $1$ line. End the output with a newline.

Sample

Sample 1
Input
ukuku
Output
4

The length of the longest palindrome contained in the string "kuku", obtained by deleting character $1$, is $3$.
The length of the longest palindrome contained in the string "uuku", obtained by deleting character $2$, is $3$.
The length of the longest palindrome contained in the string "ukku", obtained by deleting character $3$, is $4$.
The length of the longest palindrome contained in the string "ukuu", obtained by deleting character $4$, is $3$.
The length of the longest palindrome contained in the string "ukuk", obtained by deleting character $5$, is $3$.
Therefore, the maximum 'Tapisa' of the string after deleting $1$ character is $4$.

Sample 2
Input
ukunichia
Output
3

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。