其他分享
首页 > 其他分享> > 找出最长连续子串

找出最长连续子串

作者:互联网

def func(s: str):
temp = ''
count = 0
for i in range(len(s)):
for j in range(i + 1, len(s)):
if s[i] != s[j]:
break
j += 1
if count < j - i:
count = j - i
temp = s[i:j]
i = j
return temp, count


if __name__ == '__main__':
print(func('adsgggggsdfssssssseeeee'))

标签:子串,__,找出,temp,count,len,range,func,最长
来源: https://www.cnblogs.com/bigcoolcool/p/16328494.html