P-6-7. LCS
輸入兩字串, 計算其 LCS 的長度。
輸入格式
第一行與第二行個有一個字串, 字串均只含小寫字母,長度不超過 \( 500 \)
輸出格式
LCS 長度。
範例輸入一
algorithm
alignment
範例輸出一
4
範例輸入二
fakefamefade
acefaaace
範例輸出二
6
輸入兩字串, 計算其 LCS 的長度。
第一行與第二行個有一個字串, 字串均只含小寫字母,長度不超過 \( 500 \)
LCS 長度。
algorithm
alignment
4
fakefamefade
acefaaace
6
Comments