Longest common subsequence

Write lcs(a, b) that returns the length of the longest sequence of characters that appears in both strings in the same order, not necessarily adjacent.

lcs("abcde", "ace")  ->  3
lcs("abc", "def")    ->  0
lcs("", "abc")       ->  0

The point is to practise a two-string DP table: table[i][j] for the first i characters of a and the first j of b.

def lcs(a, b):
    ...