6877.Longest Palindrome

Time Limit: 1s Memory Limit: 512MB

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 Format(From the terminal/stdin)

The only input line contains a string of length $n$ . Each character is one of a–z.

  • $1 \le n \le 10^6$

Output Format(To the terminal/stdout)

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

Sample Input

Copy
aybabtu
       \n

Sample Output special judge

Copy
bab
   \n
Source: CSES, String Algorithms, 1111

Submit

请先 登录

© 2025 FAQs