No.2204 Palindrome Splitting (No Rearrangement ver.)
タグ : / 解いたユーザー数 93
作問者 :
srjywrdnprkt
/ テスター :
👑 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もしくは右上の雲マークをクリックしてアカウントを作成してください。