總之有人想救救看我嗎
import sys
a=0
for i in sys.stdin:
a+=1
n1,n2=map(int, i.split())
N1=sys.stdin.readline().split()
N2=sys.stdin.readline().split()
if n1==0 and n2==0:
break
length=[[0 for i in range(n2+1)]for j in range(n1+1)]
for i in range(1,n1+1):#避免撞邊
for j in range(1,n2+1):
if N1[i-1]==N2[j-1]:
length[i][j]=length[i-1][j-1]+1
else:
length[i][j]=max(length[i-1][j],length[i][j-1])
print("Twin Towers #%d"%a)
print("Number of Tiles : %d"%length[i][j])