Mirror in the Marquee
mediumA theater's scrolling marquee glitches when text reads the same forwards and backwards — the longer the mirrored stretch, the worse the flicker. The technician needs to find the worst offender before tonight's show.
Given the marquee string text, return the longest contiguous substring that is a palindrome. (Every test is built so the longest palindrome is unique — no tie-breaking needed.)
Example 1
in text = "bananas"
out "anana"
Example 2
in text = "marquee"
out "ee"
The doubled letter is the only mirrored stretch longer than one character.
Constraints
- · 1 <= len(text) <= 50
- · lowercase letters only
- · the longest palindromic substring is unique
solution.py● loading python…
test results
Hit ▶ Run to test your code against the visible cases.