SDE Path

Longest Palindromic Substring

Medium

Longest Palindromic Substring

Find the longest palindromic substring within a given string.

Input format

The first line contains a string S (lowercase, ≤ 30 chars).

Output format

Print the longest palindromic substring; ties → leftmost.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
xvsoyeukatlols
Expected output
lol
Example 2
Input
eqflerbyasqrkuxqjgrxxlkrwqadi
Expected output
xx