Loading problem…
You're building a text analysis feature that needs to find the longest palindromic substring. This is useful for text processing, pattern matching, and string analysis.
Given a string s, return the longest palindromic substring in s.
A palindrome is a string that reads the same backward as forward.
longestPalindrome("babad"); // "bab" or "aba"
longestPalindrome("cbbd"); // "bb"
longestPalindrome("a"); // "a"This problem models real text processing scenarios: