我这辈子都不会忘记这两道题目,忘记那些时光...
写于2011-01-23 21:19
题目如下:
Input will contain between 1 and 50 characters, inclusive . Each character of input will be an uppercase letter ('A' - 'Z').
A: Examples
"XBCDEFYWFEDCBZ"
Return: "BCDEF"
We see that the reverse of BCDEF is FEDCB, which appears later in the string.
B: "ABCABA"
Return: "ABA"
The String ABA is a palindrome(it's its own reversal), So it meets the criteria.
这两个题目引出了两个概念:绝对回文 和 相对回文