# 找到重复的substring h="hello,Welcome Manulife" # h="dfsfsd fdgf fdgdfgd asdda asasd" lh=list(h) dih={} for i in range(len(lh)): for k in range(len(lh)): temp=lh[i:k] s="" for p in temp: s+=p if s not in dih.keys(): dih[s]=1 else: dih[s]+=1 # print(dih) for k,v in list(dih.items()): if len(k.strip())>=2 and v>1: print("{}:{}".format(k,v))
找到重复的子串
最新推荐文章于 2024-10-02 10:19:33 发布