11260 - Find Palindrom   

Description

A palindrome is a string that is identical to its reverse, like "level" or "aa".

Given a string, find the longest palindrome in the string.

Hint.
You can use the following partial code to check each possible substring.

for(start = 0; start < strlen(input); start++){ 
    for(end = start; end < strlen(input); end++){ 
        ToDo
    } 
}

Input

The input has only one line, which contains a string.

The length of the string is less than 1000.

Output

Output the longest palindrome in the string.

If there are many palindromes with the same length, output the first one in the string.

Note that you DO NOT need to print a newline character (‘\n’) at the end of the line.

Sample Input  Download

Sample Output  Download

Tags




Discuss