爱奇艺8.23算法 分词题
s1=list(map(str,input().split())) ss=''.join(s1) s2=list(map(str,input().split())) s=0 l=[0] li=[] li2=[] ll=[] for i in s1: s+=len(i) l.append(s) for j in s2: for k in range(len(ss)-len(j)+1): if ss[k:k+len(j)]==j: for sttt in range(len(l)): if k<l[sttt]<k+len(j): li.append(l[sttt]) li2.append(k) li2.append(k+len(j)) for i in l: if i not in li: ll.append(i) for i in li2: ll.append(i) ll=list(set(ll)) print(l,li,li2,ll) for i in range(len(ll)-1): print(ss[ll[i]:ll[i+1]],end=' ')
#笔试题目##爱奇艺#