寻找最长不含有重复字符的子串
s = "abcdbabc" def max_str(s): max_str = '' str_li = '' for i in s: if i not in str_li: str_li+=i else: str_li = str_li[str_li.index(i)+1:] str_li+=i max_str = str_li if len(str_li) > len(max_str) else max_str print(max_str) print(len(max_str)) max_str(s)