#K48307. Longest Palindromic Substring Finder
Longest Palindromic Substring Finder
Longest Palindromic Substring Finder
Given a string s, your task is to find the longest palindromic substring in s. A palindrome is a string that reads the same forwards and backwards. If there are multiple palindromic substrings with the same maximum length, return the one that appears first in s.
For example, for the input "babad", both "bab" and "aba" are palindromic substrings, but your program should return "bab" if it appears first. The solution should handle edge cases such as empty strings or strings of length one.
inputFormat
The input consists of a single line containing the string s.
outputFormat
Output the longest palindromic substring from s to the standard output. If there are multiple valid answers, output the one that appears first in the string.
## samplebabad
bab