Longest palindromic substring · Compiler

Longest palindromic substring

Find the longest contiguous substring that reads the same forward and backward. If several starting positions give the maximum length, take the earliest one in the input.

Input
One word of 1 to 200 lowercase English letters.
Output
Print the chosen substring.

Compiler Explorer runs your code when you run or check it.

Loading your exercise draft…