PALIM - 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 occurring 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.
hide comments
cegprakash:
2019-06-20 14:40:09
Copy pasting the tester code on Visual Studio was auto correcting spacings and tabs. But copy pasting on wordpad gave AC.
|
|
Pranet Verma:
2013-05-27 21:01:40
what exactly are we supposed to do with the tester library? can we make changes to it ? and where do we store the answer? |
|
lovelotus:
2013-04-30 17:40:01
Can you please tell why it says "Your solution don't match the header file", even when when i have followed the instructions and it works well on my system... id 9184095 :( |
|
:D:
2012-09-23 20:33:11
RE nhs: did you paste the header given in description?
|
|
nhs:
2012-08-03 09:10:43
"Your solution don't match the header file". I am not getting what I am supposed to do for this. Please check, my submission id : 7409465 |
|
যোবায়ের:
2011-06-09 18:45:36
"Your solution don't match the header file" but I just copied and pasted the testlib header before my code. I can't understand :-? submission ID 3551548
|
|
[Trichromatic] XilinX:
2011-06-09 18:45:36
After solving this problem you can try problem PALDR. |
Added by: | Bin Jin |
Date: | 2008-10-23 |
Time limit: | 1s |
Source limit: | 10240B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C++ 4.3.2 CPP |
Resource: | the (second??) "interactive" problem on SPOJ |