spoj#PALIM. Yet Another Longest Palindrome Problem
Yet Another Longest Palindrome Problem
A string is called a palindrome if it's the same when read from left to right and from right to left. For example, "abdba" is a palindrome, but "abbaa" is not.
Given a string, print the length of the longest consecutive sequence of characters occurrences at least once in this string, which is a palindrome.
Input
- Line 1: a string consists of at most 100000 characters. The ASCII code of all characters are between 32 and 127, inclusive.
- Line 2: a magical key(for security purpose).
Output
- Line 1: the length of the longest palindrome.
- Line 2: the magical key.
Example
Input: abaabbabaaba MAGICAL KEY Output: 6 MAGICAL KEY
Restriction
Only C++ is allowed in this problem now. In addition, you will receive "wrong answer" if your program don't start with this. You can't use macro "#undef" in your solution as well.
If you want to solve this problem in another language, send me the header file in your language please.
warning: Don't try to access the memory of tester, or I will reject your solution manually, and you will lose the chance to enjoy this problem as well.
Hint
hint of using tester library: you can't read anything from stdin, and you can't print anything as well, your program will be terminated if you called answer().
hint of viewing feedback: You can click on "wrong answer" link to view the feedback of judge: whether your solution didn't include the testlib, or failed on sample. (if neither, your solution failed on a further test case)
Notice
update on Oct.24: I had updated the header file for C++, now you will receive "Runtime Error(NZEC)" if your solution called isSame() illegally. The submissions with old version of header file are still acceptable.
rejudge on Oct.24: some test cases were added, three submissions were rejudged as TLE instead of AC.