#C13848. Longest Palindrome Finder
Longest Palindrome Finder
Longest Palindrome Finder
Given a string, find the longest palindromic substring after removing all non-alphanumeric characters and ignoring case. The input string is first cleaned by converting all letters to lowercase and removing any characters that are not letters or digits. If there are multiple palindromes of the same maximum length, return the one that appears first in the cleaned string.
For example, the string "A man, a plan, a canal: Panama" is cleaned to "amanaplanacanalpanama", and its longest palindrome is the entire cleaned string. Use the concept of palindrome checking, where a string \(s\) is a palindrome if \(s = s^R\), where \(s^R\) denotes the reverse of \(s\).
inputFormat
The input is provided via standard input (stdin) as a single line containing the string.
outputFormat
Print to standard output (stdout) the longest palindromic substring, in lowercase.## sample
racecar
racecar