Palindrome is a string that can be read in the same way in either forward or backward direction. For example: ABBA is a palindrome, MOM is also a palindrome, but MATE is not. A non-palindrome string can be transformed into a palindrome by changing some of its characters. We call a string a k
Given a string S
The first line of the input contains an integer T
$(1 \le |S| \le 1000)$
-->
(1
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/634.png"
ALT="$ \le$">| S|
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/634.png"
ALT="$ \le$">1000)
$(0 \le K \le |S|)$
-->
(0
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/634.png"
ALT="$ \le$">K
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/634.png"
ALT="$ \le$">| S|)
<TT>a</TT>' <SPAN CLASS="MATH">...</SPAN>
z') only. | S|
<tex2html_verbatim_mark>
For each case, print in a single line: the length of the longest substring of S
3
abba 0
mate 1
zabcddcbxy 1
4
3
8
Migrated from old NTUJ.
ACM ICPC regional Jakarta site 2008
No. | Testdata Range | Score |
---|