We define a palindrome as a sequence of at least one integer that reads the same either forward or backward. For example
1 3 5 3 1 and
1 2 2 1 are both palindromes. To the extreme case
1 is also a palindrome. We also define a double palindrome as the concatenation of two palindromes. For example
1 3 5 3 1 1 2 2 1 is a double palindrome. To the extreme case
1 3 5 3 1 1 is also a double palindromes. Now given a sequence of at least two integers, please find the longest double palindrome. If there are multiple longest double palindromes, print the one that appears last .
The number of integers in the given sequence is no more than 100.
There is one line in the input. The first line has the integers from which we want to find the longest double palindrome.
There is one lines in the output. The first line has all the integers of the longest double palindrome. number of ways as in the description.
7 1 3 5 3 1 1
1 3 5 3 1 1
感謝 B05902052 劉家維 同學增加測資