Longest common subsequence

FCC link

The longest common subsequence (or LCS) of groups A and B is the longest group of elements from A and B that are common between the two groups and in the same order in each group. For example, the sequences "1234" and "1224533324" have an LCS of "1234":

1234

_12_245_33324_

For a string example, consider the sequences "thisisatest" and "testing123testing". An LCS would be "tsitest":

_t_hi_sisatest_

_t_e_sting123test_ing.

Your code only needs to deal with strings.

For more information on this problem please see Wikipedia.

Test

{{test}}

Console output