(string, sub)
return lengths[len(string)][len(sub)]
Calculates longest common subsequence for a pair of tokenized strings
    :param string : list of str : tokens from a string split using whitespace
    :param sub : list of str : shorter string, also split using whitespace
    :returns: length (list of int): length of the longest common subsequence between the two strings

    Note: my_lcs only gives length of the longest common subsequence, not the actual LCS
Calculates longest common subsequence for a pair of tokenized strings
    :param string : list of str : tokens from a string split using whitespace
    :param sub : list of str : shorter string, also split using whitespace
    :returns: length (list of int): length of the longest common subsequence between the two strings
Calculates longest common subsequence for a pair of tokenized strings : param string : list of str : tokens from a string split using whitespace : param sub : list of str : shorter string also split using whitespace : returns : length ( list of int ) : length of the longest common subsequence between the two strings
def my_lcs(string, sub):
    """
    Calculates longest common subsequence for a pair of tokenized strings
    :param string : list of str : tokens from a string split using whitespace
    :param sub : list of str : shorter string, also split using whitespace
    :returns: length (list of int): length of the longest common subsequence between the two strings

    Note: my_lcs only gives length of the longest common subsequence, not the actual LCS
    """
    if(len(string)< len(sub)):
        sub, string = string, sub

    lengths = [[0 for i in range(0,len(sub)+1)] for j in range(0,len(string)+1)]

    for j in range(1,len(sub)+1):
        for i in range(1,len(string)+1):
            if(string[i-1] == sub[j-1]):
                lengths[i][j] = lengths[i-1][j-1] + 1
            else:
                lengths[i][j] = max(lengths[i-1][j] , lengths[i][j-1])

    return lengths[len(string)][len(sub)]
def my_lcs ( string , sub ) : if ( len ( string ) < len ( sub ) ) : sub , string = string , sub lengths = [ [ 0 for i in range ( 0 , len ( sub ) + 1 ) ] for j in range ( 0 , len ( string ) + 1 ) ] for j in range ( 1 , len ( sub ) + 1 ) : for i in range ( 1 , len ( string ) + 1 ) : if ( string [ i - 1 ] == sub [ j - 1 ] ) : lengths [ i ] [ j ] = lengths [ i - 1 ] [ j - 1 ] + 1 else : lengths [ i ] [ j ] = max ( lengths [ i - 1 ] [ j ] , lengths [ i ] [ j - 1 ] ) return lengths [ len ( string ) ] [ len ( sub ) ]