input input la len lb len lb for in range la for in range la for in ra

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
a = input()
b = input()
la = len(a)
lb = len(b)
o = [[0]*(lb + 1) for i in range(la + 1)]
for i in range(la + 1):
for j in range(lb + 1):
if x[i - 1] == y[j - 1]:
o[i][j] = o[i - 1][j - 1] + 1
else:
o[i][j] = max(o[i - 1][j], o[i][j - 1])
print(print(a[i]) for i in range(len(a)))