Havannah = Hannah

Given a sequence of characters, you are asked to find the longest palindrome within it. There is a catch: the palindrome can be built by jumping over certain letters as long as it is in order. For example for the string havannah, the hiden palindrome would be:

havannah=hannah\color{#D61F06} {\text{ha}} \text{va} \color{#D61F06} {\text{nnah}} = \text{hannah}

A string might have more than one such hidden palindrome. For example ,alfalfa has four hidden palindromes of length 55: 'alala', 'afafa', 'alfla','aflfa'

Find the length of the longest hidden palindrome for the following string.

×

Problem Loading...

Note Loading...

Set Loading...