CSES - Longest Palindrome | Xâu đối xứng dài nhất

View as PDF



Authors:
Problem types
Points: 1500 (p) Time limit: 1.0s Memory limit: 512M Input: stdin Output: stdout

Given a string, your task is to determine the longest palindromic substring of the string. For example, the longest palindrome in aybabtu is bab.

Input

  • The only input line contains a string of length \(n\). Each character is one of a - z.

Output

  • Print the longest palindrome in the string. If there are several solutions, you may print any of them.

Constraints

  • \(1 \leq n \leq 10 ^ 6\)

Example

Sample input

aybabtu

Sample output

bab


Comments (8)

Most recent
Loading comments...