103201: [Atcoder]ABC320 B - Longest Palindrome
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:12
Solved:0
Description
Score : $200$ points
Problem Statement
You are given a string $S$.
Find the maximum length of a contiguous substring of $S$ that is a palindrome.
Note that there is always a contiguous substring of $S$ that is a palindrome.
Constraints
- $S$ is a string of length between $2$ and $100$, inclusive, consisting of uppercase English letters.
Input
The input is given from Standard Input in the following format:
$S$
Output
Print the answer.
Sample Input 1
TOYOTA
Sample Output 1
5
TOYOT
, a contiguous substring of TOYOTA
, is a palindrome of length $5$.
TOYOTA
, the only length-$6$ contiguous substring of TOYOTA
, is not a palindrome, so print $5$.
Sample Input 2
ABCDEFG
Sample Output 2
1
Every contiguous substring of length $1$ is a palindrome.
Sample Input 3
AAAAAAAAAA
Sample Output 3
10
Output
分数:200分
问题描述
给定一个字符串$S$。找到$S$中最长的连续子串,该子串是一个回文串。注意,$S$中总是有一个连续子串是一个回文串。
约束条件
- $S$是一个长度在2到100之间的字符串,由大写英文字母组成。
输入
输入从标准输入给出,格式如下:
$S$
输出
输出答案。
样例输入1
TOYOTA
样例输出1
5
TOYOT
,是TOYOTA
的一个连续子串,是一个长度为5的回文串。
TOYOTA
,是TOYOTA
的唯一长度为6的连续子串,不是一个回文串,因此输出5。
样例输入2
ABCDEFG
样例输出2
1
长度为1的连续子串都是回文串。
样例输入3
AAAAAAAAAA
样例输出3
10
HINT
输出最长回文串的长度?