Longest palindromic subsequence

Write lps(text) that returns the length of the longest subsequence of text (characters in order, not necessarily adjacent) that is a palindrome.

lps("bbbab")  ->  4     (bbbb)
lps("cbbd")   ->  2
lps("")       ->  0

A table over substrings text[i..j]: equal ends add 2 to the inside, otherwise take the better of dropping one end. Fill by increasing length. Equivalent to the longest common subsequence of the text with its reverse.

def lps(text):
    ...