题解 | #公共子串计算#动态规划法
公共子串计算
http://www.nowcoder.com/practice/98dc82c094e043ccb7e0570e5342dd1b
```def solution(s1, s2):
mxlen = 0
dp = [[0 for i in range(len(s2)+1)] for j in range(len(s1)+1)]
for i in range(len(s1)):
for j in range(len(s2)):
if s1[i] == s2[j]:
dp[i+1][j+1] = dp[i][j] + 1
if dp[i+1][j+1] >mxlen:
mxlen = dp[i+1][j+1]
return mxlen
while True:
try:
s1 = input()
s2 = input()
print(solution(s1,s2))
except:
break;