← All problemsSign in

Longest Palindrome

CSESString AlgorithmsOpen on judge ↗

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 \le n \le 10^6 Example Input: ay

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start