分析 s1: asd s2: werasd 定义 map[i][j] 为s1[0..i],s2[0..j]的最长子串长度 0 1 2 0 0 - - 1 0 0 - 3 1 0 0 4 0 2 0 5 0 0 3 转移方程 P(i,j) = P(i-1,j-1) + 1 代码 str_tmp = [] str_tmp << gets.strip str_tmp << gets.strip str1 ,str2 = '', '' if str_tmp.first.size < str_tmp.last.size st...