問題一覧 > 通常問題

No.2204 Palindrome Splitting (No Rearrangement ver.)

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 93
作問者 : srjywrdnprkt / テスター : 👑 seekworser
お気に入りにしたユーザー ProblemId : 9103 / 自分の提出
問題文最終更新日: 2023-01-31 19:50:18
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
yukicoder contest 375 (順位表) の他の問題:

Problem Statement

You have a string $S$. $S$ consists only of lowercase English letters.
You split $S$ at arbitrary positions to make some strings $s_1,~s_2, \cdots,~ s_N$ ($N$ is arbitrary). However, each $s_i$ must be a palindrome.
Let $X$ be the minimum length of the $s_i$. You want to make $X$ as large as possible. Find the maximum value of $X$.

Input

$S$

The input satisfies the following constraints.

  • $1\leq |S| \leq 5000$
  • $S$ consists only of lowercase English letters.

Output

Output the maximum value of $X$. Print a newline at the end.

Sample

Sample 1
Input
aaababbaa
Output
2

You can split it as aa aba bb aa.

Sample 2
Input
ababababa
Output
9

$S$ itself may be a palindrome. In this case, it is optimal not to split it.

Sample 3
Input
abcdefghijklmnopqrstuvwxyz
Output
1

Note that a string consisting of a single lowercase English letter is a palindrome.

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