def abc(str,data): count = [] numMax = 0 for a in range(len(str)): if a == 0: temp = str.find(data, numMax, len(str)) else: temp = str.find(data, numMax+1, len(str)) if temp != -1: for i in range(len(data)): count.append(temp + i) elif numMax == 0 and count != None: return -1 if numMax == max(count): return count numMax = max(count)# print(abc(input("请输入一个序列为查找基础:"),input("输入查找内容:")))print(abc("abcfgggabjfhgfabc","abc"))
原文地址:https://www.cnblogs.com/pygo/p/12015839.html
时间: 2024-10-16 02:29:32