l=["abc","apple"]
s="abcpple"
max=-1
res=""
curr_str=""
for i in l:
k=0
for j in i:
if(j in s[k:]):
k=s.index(j)
curr_str=curr_str+j
if(len(res)>max):
res=curr_str
curr_str=""
print(res)
print(len(res))
To embed this program on your website, copy the following code and paste it into your website's HTML: