Else value is obtained considering two cases . a ) All substrings without last character in S b ) All substrings without last characters in both .
else : NEW_LINE INDENT mat [ i ] [ j ] = ( mat [ i ] [ j - 1 ] + mat [ i - 1 ] [ j - 1 ] ) NEW_LINE DEDENT return mat [ m ] [ n ] NEW_LINE